renma 0.16.0 → 0.18.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/CHANGELOG.md +157 -1
- package/README.md +219 -748
- package/architecture.md +533 -0
- package/design.md +469 -0
- package/dist/agent-skills.d.ts +1 -1
- package/dist/agent-skills.d.ts.map +1 -1
- package/dist/agent-skills.js +28 -8
- package/dist/agent-skills.js.map +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +120 -12
- package/dist/catalog.js.map +1 -1
- package/dist/cli-help.d.ts +15 -9
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +32 -9
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +162 -40
- package/dist/cli.js.map +1 -1
- package/dist/commands/bom.d.ts +6 -3
- package/dist/commands/bom.d.ts.map +1 -1
- package/dist/commands/bom.js +27 -7
- package/dist/commands/bom.js.map +1 -1
- package/dist/commands/catalog.d.ts +1 -1
- package/dist/commands/catalog.d.ts.map +1 -1
- package/dist/commands/catalog.js +11 -4
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/ci-report.d.ts.map +1 -1
- package/dist/commands/ci-report.js +18 -5
- package/dist/commands/ci-report.js.map +1 -1
- package/dist/commands/diff.js +8 -2
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/graph.d.ts +6 -2
- package/dist/commands/graph.d.ts.map +1 -1
- package/dist/commands/graph.js +30 -14
- package/dist/commands/graph.js.map +1 -1
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +2 -0
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/ownership.d.ts +4 -3
- package/dist/commands/ownership.d.ts.map +1 -1
- package/dist/commands/ownership.js +27 -23
- package/dist/commands/ownership.js.map +1 -1
- package/dist/commands/readiness.d.ts +2 -1
- package/dist/commands/readiness.d.ts.map +1 -1
- package/dist/commands/readiness.js +105 -36
- package/dist/commands/readiness.js.map +1 -1
- package/dist/commands/scaffold.d.ts +3 -0
- package/dist/commands/scaffold.d.ts.map +1 -1
- package/dist/commands/scaffold.js +28 -2
- package/dist/commands/scaffold.js.map +1 -1
- package/dist/commands/suggest-metadata.d.ts.map +1 -1
- package/dist/commands/suggest-metadata.js +56 -8
- package/dist/commands/suggest-metadata.js.map +1 -1
- package/dist/commands/suggest-semantic-split.js +3 -3
- package/dist/commands/suggest-semantic-split.js.map +1 -1
- package/dist/commands/trust-graph.d.ts.map +1 -1
- package/dist/commands/trust-graph.js +12 -0
- package/dist/commands/trust-graph.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -3
- package/dist/config.js.map +1 -1
- package/dist/dependency-resolution.d.ts +6 -0
- package/dist/dependency-resolution.d.ts.map +1 -0
- package/dist/dependency-resolution.js +11 -0
- package/dist/dependency-resolution.js.map +1 -0
- package/dist/diagnostic-ids.d.ts +8 -0
- package/dist/diagnostic-ids.d.ts.map +1 -1
- package/dist/diagnostic-ids.js +8 -0
- package/dist/diagnostic-ids.js.map +1 -1
- package/dist/discovery.d.ts +33 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +178 -80
- package/dist/discovery.js.map +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +15 -0
- package/dist/markdown.js.map +1 -1
- package/dist/model.d.ts +17 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +4 -1
- package/dist/model.js.map +1 -1
- package/dist/quality-profile.d.ts +91 -0
- package/dist/quality-profile.d.ts.map +1 -0
- package/dist/quality-profile.js +91 -0
- package/dist/quality-profile.js.map +1 -0
- package/dist/repeated-context.d.ts.map +1 -1
- package/dist/repeated-context.js +38 -83
- package/dist/repeated-context.js.map +1 -1
- package/dist/repository-boundary.d.ts +30 -0
- package/dist/repository-boundary.d.ts.map +1 -0
- package/dist/repository-boundary.js +116 -0
- package/dist/repository-boundary.js.map +1 -0
- package/dist/repository-evidence.d.ts +2 -0
- package/dist/repository-evidence.d.ts.map +1 -1
- package/dist/repository-evidence.js +6 -4
- package/dist/repository-evidence.js.map +1 -1
- package/dist/repository-paths.d.ts +19 -2
- package/dist/repository-paths.d.ts.map +1 -1
- package/dist/repository-paths.js +123 -14
- package/dist/repository-paths.js.map +1 -1
- package/dist/rules.d.ts +2 -0
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +322 -256
- package/dist/rules.js.map +1 -1
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +5 -1
- package/dist/scanner.js.map +1 -1
- package/dist/security-diagnostics.d.ts.map +1 -1
- package/dist/security-diagnostics.js +95 -30
- package/dist/security-diagnostics.js.map +1 -1
- package/dist/security-diff.d.ts +5 -2
- package/dist/security-diff.d.ts.map +1 -1
- package/dist/security-diff.js +20 -4
- package/dist/security-diff.js.map +1 -1
- package/dist/security-policy-inventory.d.ts +15 -3
- package/dist/security-policy-inventory.d.ts.map +1 -1
- package/dist/security-policy-inventory.js +123 -26
- package/dist/security-policy-inventory.js.map +1 -1
- package/dist/security-policy.d.ts +7 -0
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +70 -7
- package/dist/security-policy.js.map +1 -1
- package/dist/security-posture.d.ts.map +1 -1
- package/dist/security-posture.js +2 -1
- package/dist/security-posture.js.map +1 -1
- package/dist/skill-migration.js +2 -0
- package/dist/skill-migration.js.map +1 -1
- package/dist/static-support.d.ts +13 -0
- package/dist/static-support.d.ts.map +1 -0
- package/dist/static-support.js +284 -0
- package/dist/static-support.js.map +1 -0
- package/dist/token-estimator.d.ts +21 -0
- package/dist/token-estimator.d.ts.map +1 -0
- package/dist/token-estimator.js +84 -0
- package/dist/token-estimator.js.map +1 -0
- package/dist/trust-graph.d.ts +3 -3
- package/dist/trust-graph.d.ts.map +1 -1
- package/dist/trust-graph.js +76 -21
- package/dist/trust-graph.js.map +1 -1
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +61 -0
- package/docs/advanced-skill-authoring.md +147 -0
- package/docs/agent-skills-compatibility.md +508 -0
- package/docs/authoring-guide.md +382 -0
- package/docs/context-conflict-diagnostics.md +32 -0
- package/docs/context-language-diagnostics.md +99 -0
- package/docs/context-lens.md +253 -0
- package/docs/context-lifecycle-diagnostics.md +55 -0
- package/docs/diagnostics.md +406 -0
- package/docs/metadata-budget.md +14 -0
- package/docs/quality-profile.md +123 -0
- package/docs/repository-context-bom.md +172 -0
- package/docs/schemas/repository-context-bom-v2.schema.json +648 -0
- package/docs/schemas/trust-graph-v2.schema.json +301 -0
- package/docs/security-policy.md +354 -0
- package/docs/trust-graph.md +47 -0
- package/docs/user-manual.md +842 -0
- package/examples/context-lens/README.md +101 -0
- package/examples/context-lens/contexts/testing/boundary-value-analysis.md +23 -0
- package/examples/context-lens/lenses/testing/spec-review-boundary-values.md +29 -0
- package/examples/context-lens/lenses/testing/test-design-boundary-values.md +29 -0
- package/examples/context-lens/skills/testing/spec-review/SKILL.md +49 -0
- package/examples/context-repo/README.md +148 -0
- package/examples/context-repo/contexts/domain/payment/idempotency.md +27 -0
- package/examples/context-repo/contexts/testing/boundary-value-analysis.md +26 -0
- package/examples/context-repo/contexts/testing/negative-testing.md +26 -0
- package/examples/context-repo/lenses/testing/spec-review-boundary-values.md +35 -0
- package/examples/context-repo/renma.config.json +12 -0
- package/examples/context-repo/skills/testing/spec-review/SKILL.md +71 -0
- package/examples/context-repo/tools/appium/README.md +14 -0
- package/examples/github-actions/renma-ci-report.yml +36 -0
- package/examples/interactive-placeholder/README.md +104 -0
- package/examples/interactive-placeholder/assets/template.txt +1 -0
- package/examples/interactive-placeholder/renma.config.json +6 -0
- package/examples/interactive-placeholder/skills/replace-placeholder/SKILL.md +54 -0
- package/examples/interactive-placeholder/tools/README.md +48 -0
- package/examples/interactive-placeholder/tools/placeholder-demo.mjs +99 -0
- package/package.json +10 -1
- package/plan-discovery.md +749 -0
- package/plan.md +90 -0
- package/scripts/verify-package.mjs +104 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Interactive Placeholder Example
|
|
2
|
+
|
|
3
|
+
This small example demonstrates a clarify-before-act interaction described by
|
|
4
|
+
a governed Skill. A consuming agent prepares and inspects a disposable file,
|
|
5
|
+
asks one focused question when a value is missing, waits, applies the validated
|
|
6
|
+
answer with a local CLI, and verifies the result.
|
|
7
|
+
|
|
8
|
+
A Skill can define a clarify-before-act interaction: inspect the current state,
|
|
9
|
+
ask for missing information, wait, and act only after the user supplies it.
|
|
10
|
+
|
|
11
|
+
## Responsibility Boundary
|
|
12
|
+
|
|
13
|
+
Renma:
|
|
14
|
+
|
|
15
|
+
- discovers and validates the Skill and repository assets;
|
|
16
|
+
- checks workflow clarity, required inputs, helper-command paths, metadata,
|
|
17
|
+
security policy, and repository structure; and
|
|
18
|
+
- provides deterministic scan and readiness evidence.
|
|
19
|
+
|
|
20
|
+
Renma does not run the interaction, execute the Node.js tool, ask the user,
|
|
21
|
+
store conversational state, or resume the workflow.
|
|
22
|
+
|
|
23
|
+
The consuming agent:
|
|
24
|
+
|
|
25
|
+
- follows [`skills/replace-placeholder/SKILL.md`](skills/replace-placeholder/SKILL.md);
|
|
26
|
+
- runs the fixed local CLI commands;
|
|
27
|
+
- notices the missing replacement, asks one question, and waits;
|
|
28
|
+
- validates the user's answer before applying it; and
|
|
29
|
+
- inspects and reports the result.
|
|
30
|
+
|
|
31
|
+
The user supplies the missing value, can inspect the resulting file, and
|
|
32
|
+
retains final control over it.
|
|
33
|
+
|
|
34
|
+
## Prerequisites
|
|
35
|
+
|
|
36
|
+
- Node.js 22 or newer for the local demonstration.
|
|
37
|
+
- A built Renma checkout for the `node dist/index.js` inspection commands.
|
|
38
|
+
- Run the Renma commands below from the repository root.
|
|
39
|
+
|
|
40
|
+
## Inspect With Renma
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run build
|
|
44
|
+
node dist/index.js scan examples/interactive-placeholder --fail-on high
|
|
45
|
+
node dist/index.js catalog examples/interactive-placeholder --format markdown
|
|
46
|
+
node dist/index.js readiness examples/interactive-placeholder --format markdown
|
|
47
|
+
node dist/index.js inspect examples/interactive-placeholder/skills/replace-placeholder/SKILL.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
With an installed CLI, the equivalent commands are:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
renma scan examples/interactive-placeholder --fail-on high
|
|
54
|
+
renma catalog examples/interactive-placeholder --format markdown
|
|
55
|
+
renma readiness examples/interactive-placeholder --format markdown
|
|
56
|
+
renma inspect examples/interactive-placeholder/skills/replace-placeholder/SKILL.md
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Try The Interaction
|
|
60
|
+
|
|
61
|
+
Change into the example directory, then prepare and inspect the disposable
|
|
62
|
+
output:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cd examples/interactive-placeholder
|
|
66
|
+
node tools/placeholder-demo.mjs prepare
|
|
67
|
+
node tools/placeholder-demo.mjs inspect
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Expected state:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
State: waiting for a replacement value (<placeholder> remains).
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
At this boundary, the consuming agent asks for one value matching
|
|
77
|
+
`[A-Za-z0-9_-]{1,32}` and waits without modifying the file. After the user
|
|
78
|
+
supplies a valid value, for example `Renma_017`, the agent passes it as one
|
|
79
|
+
argument and verifies the result:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
node tools/placeholder-demo.mjs apply Renma_017
|
|
83
|
+
node tools/placeholder-demo.mjs inspect
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Expected verification:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
State: complete. Hello, Renma_017!
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Run `node tools/placeholder-demo.mjs prepare` at any time to recreate
|
|
93
|
+
`workspace/output.txt` from the immutable `assets/template.txt`. The generated
|
|
94
|
+
output is ignored by Git, so repeating the example does not modify a tracked
|
|
95
|
+
fixture.
|
|
96
|
+
|
|
97
|
+
## Intentionally Not Demonstrated
|
|
98
|
+
|
|
99
|
+
This example does not add a Renma runtime feature, Context Asset, Context Lens,
|
|
100
|
+
workflow state machine, platform Plan mode, runtime Skill selection, prompt
|
|
101
|
+
assembly, provider integration, agent execution, automatic question asking,
|
|
102
|
+
automatic resume, network access, uploads, or repository rewriting. It isolates
|
|
103
|
+
one interaction pattern that an external consuming agent can execute from a
|
|
104
|
+
statically governed Skill.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello, <placeholder>!
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: replace-placeholder
|
|
3
|
+
description: Prepare this example's disposable placeholder file, ask for a constrained replacement, then apply and verify it. Use only for interactive-placeholder; do not use for arbitrary text, other files, or unattended edits.
|
|
4
|
+
metadata:
|
|
5
|
+
renma.id: skill.example.replace-placeholder
|
|
6
|
+
renma.owner: maintainers
|
|
7
|
+
renma.allowed-data: '["repo-local-files","disclosed-user-provided-data"]'
|
|
8
|
+
renma.network-allowed: "false"
|
|
9
|
+
renma.external-upload-allowed: "false"
|
|
10
|
+
renma.secrets-allowed: "false"
|
|
11
|
+
renma.requires-human-approval: "false"
|
|
12
|
+
renma.forbidden-inputs: '["secrets","credentials","personal-data"]'
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Replace Placeholder
|
|
16
|
+
|
|
17
|
+
## Routing
|
|
18
|
+
|
|
19
|
+
Use only in `examples/interactive-placeholder`. The consuming agent follows the
|
|
20
|
+
[local tool guide](../../tools/README.md). Renma validates the repository; the
|
|
21
|
+
agent owns the interaction and tool use.
|
|
22
|
+
|
|
23
|
+
## Required Inputs And Preflight
|
|
24
|
+
|
|
25
|
+
- The example files and write permission for `workspace/output.txt`.
|
|
26
|
+
- One user value matching `[A-Za-z0-9_-]{1,32}`, initially missing.
|
|
27
|
+
|
|
28
|
+
## Clarify-Before-Act Workflow
|
|
29
|
+
|
|
30
|
+
1. Follow the guide's `prepare` and `inspect` operations.
|
|
31
|
+
2. If inspection shows a missing replacement, ask one focused question for an
|
|
32
|
+
accepted value, then stop and wait.
|
|
33
|
+
3. Validate the response without changing it.
|
|
34
|
+
4. For a valid response, follow the guide's `apply` and `inspect` operations.
|
|
35
|
+
5. Verify the placeholder is absent and the value is present, then report the
|
|
36
|
+
inspected result for human review.
|
|
37
|
+
|
|
38
|
+
## Hard Constraints
|
|
39
|
+
|
|
40
|
+
- Use only the fixed guide and its anchored paths.
|
|
41
|
+
- If the value is missing, ask one focused question and stop.
|
|
42
|
+
- If the value is invalid, explain the accepted format, ask again, and stop.
|
|
43
|
+
- Never guess, transform, or truncate the value; ask again instead.
|
|
44
|
+
- Do not request or accept secrets, credentials, or personal data; ask for a non-sensitive value instead.
|
|
45
|
+
- Do not apply when `<placeholder>` is absent; stop and report the inspected state.
|
|
46
|
+
- Do not edit the Skill, READMEs, or immutable template; leave them unchanged.
|
|
47
|
+
- Do not access the network, upload data, or write outside the example workspace; stop and report the blocked operation.
|
|
48
|
+
- A human retains final control over the inspected result.
|
|
49
|
+
|
|
50
|
+
## Completion Criteria
|
|
51
|
+
|
|
52
|
+
Complete only after the documented `apply` succeeds and `inspect` returns
|
|
53
|
+
`State: complete` with the user value and no `<placeholder>`. Report this
|
|
54
|
+
evidence.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Placeholder Tool Guide
|
|
2
|
+
|
|
3
|
+
This local tool is the fixed operational contract for the
|
|
4
|
+
`replace-placeholder` Skill. Run it from `examples/interactive-placeholder`.
|
|
5
|
+
It accepts no file path, performs no network or upload operation, and writes
|
|
6
|
+
only the disposable `workspace/output.txt` file.
|
|
7
|
+
|
|
8
|
+
## Commands
|
|
9
|
+
|
|
10
|
+
Prepare or reset the output from the immutable template, then inspect it:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node tools/placeholder-demo.mjs prepare
|
|
14
|
+
node tools/placeholder-demo.mjs inspect
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
After a user supplies a value matching `[A-Za-z0-9_-]{1,32}`, pass the
|
|
18
|
+
validated value as exactly one argument and inspect the result:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node tools/placeholder-demo.mjs apply EXAMPLE_VALUE
|
|
22
|
+
node tools/placeholder-demo.mjs inspect
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Pass the value as an argument, never as interpolated shell source. The tool
|
|
26
|
+
rejects missing, extra, or invalid arguments and never accepts a destination
|
|
27
|
+
path.
|
|
28
|
+
|
|
29
|
+
## Behavior
|
|
30
|
+
|
|
31
|
+
- `prepare` creates `workspace/output.txt` from `assets/template.txt`. It also
|
|
32
|
+
resets a completed output back to the missing-value state.
|
|
33
|
+
- `apply` accepts one constrained value and replaces `<placeholder>` only while
|
|
34
|
+
that marker is present.
|
|
35
|
+
- `inspect` reports either the waiting state with `<placeholder>` or the
|
|
36
|
+
complete state with the rendered value.
|
|
37
|
+
- `assets/template.txt` remains immutable, while the ignored workspace output
|
|
38
|
+
is disposable and safe to remove.
|
|
39
|
+
|
|
40
|
+
## Failure And Stop Behavior
|
|
41
|
+
|
|
42
|
+
- If the output is missing, run `prepare` before inspecting or applying.
|
|
43
|
+
- If the value does not match `[A-Za-z0-9_-]{1,32}`, explain the format, ask
|
|
44
|
+
again, and stop without applying.
|
|
45
|
+
- If `<placeholder>` is absent, stop and report the current state; use
|
|
46
|
+
`prepare` only when the user wants to reset the demonstration.
|
|
47
|
+
- If the template lacks `<placeholder>` or a local filesystem operation fails,
|
|
48
|
+
stop and report the error. Leave tracked files unchanged.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const PLACEHOLDER = "<placeholder>";
|
|
6
|
+
const VALUE_PATTERN = /^[A-Za-z0-9_-]{1,32}$/;
|
|
7
|
+
const TOOL_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const EXAMPLE_ROOT = path.resolve(TOOL_DIRECTORY, "..");
|
|
9
|
+
const TEMPLATE_PATH = anchoredPath("assets", "template.txt");
|
|
10
|
+
const WORKSPACE_PATH = anchoredPath("workspace");
|
|
11
|
+
const OUTPUT_PATH = anchoredPath("workspace", "output.txt");
|
|
12
|
+
|
|
13
|
+
const [command, ...args] = process.argv.slice(2);
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
if (command === "prepare") {
|
|
17
|
+
requireArgumentCount(command, args, 0);
|
|
18
|
+
await prepare();
|
|
19
|
+
} else if (command === "apply") {
|
|
20
|
+
requireArgumentCount(command, args, 1);
|
|
21
|
+
await apply(args[0]);
|
|
22
|
+
} else if (command === "inspect") {
|
|
23
|
+
requireArgumentCount(command, args, 0);
|
|
24
|
+
await inspect();
|
|
25
|
+
} else {
|
|
26
|
+
fail(
|
|
27
|
+
"Usage: node tools/placeholder-demo.mjs <prepare|apply VALUE|inspect>",
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error instanceof Error) fail(error.message);
|
|
32
|
+
fail("Unexpected local filesystem error.");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function anchoredPath(...segments) {
|
|
36
|
+
const candidate = path.resolve(EXAMPLE_ROOT, ...segments);
|
|
37
|
+
const relative = path.relative(EXAMPLE_ROOT, candidate);
|
|
38
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
39
|
+
throw new Error("Refusing a path outside the example directory.");
|
|
40
|
+
}
|
|
41
|
+
return candidate;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function requireArgumentCount(selectedCommand, values, expected) {
|
|
45
|
+
if (values.length !== expected) {
|
|
46
|
+
throw new Error(`Invalid arguments for ${selectedCommand}.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function prepare() {
|
|
51
|
+
const template = await readFile(TEMPLATE_PATH, "utf8");
|
|
52
|
+
if (!template.includes(PLACEHOLDER)) {
|
|
53
|
+
throw new Error("Immutable template does not contain <placeholder>.");
|
|
54
|
+
}
|
|
55
|
+
await mkdir(WORKSPACE_PATH, { recursive: true });
|
|
56
|
+
await writeFile(OUTPUT_PATH, template, "utf8");
|
|
57
|
+
process.stdout.write(
|
|
58
|
+
"Prepared workspace/output.txt: replacement value is missing (<placeholder>).\n",
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function apply(value) {
|
|
63
|
+
if (!VALUE_PATTERN.test(value ?? "")) {
|
|
64
|
+
throw new Error("Invalid value: expected [A-Za-z0-9_-]{1,32}.");
|
|
65
|
+
}
|
|
66
|
+
const output = await readOutput();
|
|
67
|
+
if (!output.includes(PLACEHOLDER)) {
|
|
68
|
+
throw new Error("Cannot apply: workspace/output.txt has no <placeholder>.");
|
|
69
|
+
}
|
|
70
|
+
await writeFile(OUTPUT_PATH, output.replaceAll(PLACEHOLDER, value), "utf8");
|
|
71
|
+
process.stdout.write(`Applied value ${value} to workspace/output.txt.\n`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function inspect() {
|
|
75
|
+
const output = await readOutput();
|
|
76
|
+
if (output.includes(PLACEHOLDER)) {
|
|
77
|
+
process.stdout.write(
|
|
78
|
+
"State: waiting for a replacement value (<placeholder> remains).\n",
|
|
79
|
+
);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
process.stdout.write(`State: complete. ${output.trim()}\n`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function readOutput() {
|
|
86
|
+
try {
|
|
87
|
+
return await readFile(OUTPUT_PATH, "utf8");
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
90
|
+
throw new Error("workspace/output.txt is missing; run prepare first.");
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function fail(message) {
|
|
97
|
+
process.stderr.write(`${message}\n`);
|
|
98
|
+
process.exit(2);
|
|
99
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renma",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Manage human-curated context assets for LLMs and agents in Git.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
29
|
"scripts",
|
|
30
|
+
"docs",
|
|
31
|
+
"examples",
|
|
32
|
+
"architecture.md",
|
|
33
|
+
"design.md",
|
|
34
|
+
"plan.md",
|
|
35
|
+
"plan-discovery.md",
|
|
30
36
|
"CHANGELOG.md",
|
|
31
37
|
"LICENSE",
|
|
32
38
|
"README.md"
|
|
@@ -44,12 +50,15 @@
|
|
|
44
50
|
"format:check": "prettier --check \"**/*.{ts,js,mjs,json}\"",
|
|
45
51
|
"lint": "eslint \"{src,test}/**/*.ts\" \"{scripts,tools}/**/*.mjs\" \"eslint.config.js\"",
|
|
46
52
|
"lint:fix": "eslint --fix \"{src,test}/**/*.ts\" \"{scripts,tools}/**/*.mjs\" \"eslint.config.js\"",
|
|
53
|
+
"verify:package": "npm run build && node scripts/verify-package.mjs",
|
|
47
54
|
"split-reference": "node scripts/split-reference.mjs",
|
|
48
55
|
"suggest-semantic-split": "node dist/index.js suggest-semantic-split"
|
|
49
56
|
},
|
|
50
57
|
"devDependencies": {
|
|
51
58
|
"@eslint/js": "^10.0.1",
|
|
52
59
|
"@types/node": "^22.15.30",
|
|
60
|
+
"ajv": "^8.20.0",
|
|
61
|
+
"ajv-formats": "^3.0.1",
|
|
53
62
|
"eslint": "^10.5.0",
|
|
54
63
|
"eslint-config-prettier": "10.1.8",
|
|
55
64
|
"prettier": "^3.5.3",
|