ranty-js 1.0.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/LICENSE +21 -0
- package/README.md +235 -0
- package/dist/core/binding.d.ts +34 -0
- package/dist/core/binding.d.ts.map +1 -0
- package/dist/core/compiler/index.d.ts +5 -0
- package/dist/core/compiler/index.d.ts.map +1 -0
- package/dist/core/compiler/lexer.d.ts +30 -0
- package/dist/core/compiler/lexer.d.ts.map +1 -0
- package/dist/core/compiler/message.d.ts +4 -0
- package/dist/core/compiler/message.d.ts.map +1 -0
- package/dist/core/compiler/parser.d.ts +6 -0
- package/dist/core/compiler/parser.d.ts.map +1 -0
- package/dist/core/compiler/reader.d.ts +12 -0
- package/dist/core/compiler/reader.d.ts.map +1 -0
- package/dist/core/compiler/token-reader.d.ts +17 -0
- package/dist/core/compiler/token-reader.d.ts.map +1 -0
- package/dist/core/constants.d.ts +8 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/data-source.d.ts +6 -0
- package/dist/core/data-source.d.ts.map +1 -0
- package/dist/core/errors.d.ts +56 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/format-state.d.ts +28 -0
- package/dist/core/format-state.d.ts.map +1 -0
- package/dist/core/int64.d.ts +9 -0
- package/dist/core/int64.d.ts.map +1 -0
- package/dist/core/lang.d.ts +142 -0
- package/dist/core/lang.d.ts.map +1 -0
- package/dist/core/map-proto.d.ts +11 -0
- package/dist/core/map-proto.d.ts.map +1 -0
- package/dist/core/messages.d.ts +28 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/module-resolver.d.ts +22 -0
- package/dist/core/module-resolver.d.ts.map +1 -0
- package/dist/core/program.d.ts +14 -0
- package/dist/core/program.d.ts.map +1 -0
- package/dist/core/ranty.d.ts +70 -0
- package/dist/core/ranty.d.ts.map +1 -0
- package/dist/core/rng.d.ts +17 -0
- package/dist/core/rng.d.ts.map +1 -0
- package/dist/core/runtime/vm.d.ts +113 -0
- package/dist/core/runtime/vm.d.ts.map +1 -0
- package/dist/core/stdlib/assertion.d.ts +3 -0
- package/dist/core/stdlib/assertion.d.ts.map +1 -0
- package/dist/core/stdlib/block.d.ts +3 -0
- package/dist/core/stdlib/block.d.ts.map +1 -0
- package/dist/core/stdlib/boolean.d.ts +3 -0
- package/dist/core/stdlib/boolean.d.ts.map +1 -0
- package/dist/core/stdlib/collections.d.ts +3 -0
- package/dist/core/stdlib/collections.d.ts.map +1 -0
- package/dist/core/stdlib/compare.d.ts +3 -0
- package/dist/core/stdlib/compare.d.ts.map +1 -0
- package/dist/core/stdlib/convert.d.ts +3 -0
- package/dist/core/stdlib/convert.d.ts.map +1 -0
- package/dist/core/stdlib/format.d.ts +3 -0
- package/dist/core/stdlib/format.d.ts.map +1 -0
- package/dist/core/stdlib/general.d.ts +3 -0
- package/dist/core/stdlib/general.d.ts.map +1 -0
- package/dist/core/stdlib/generate.d.ts +3 -0
- package/dist/core/stdlib/generate.d.ts.map +1 -0
- package/dist/core/stdlib/index.d.ts +3 -0
- package/dist/core/stdlib/index.d.ts.map +1 -0
- package/dist/core/stdlib/math.d.ts +3 -0
- package/dist/core/stdlib/math.d.ts.map +1 -0
- package/dist/core/stdlib/proto.d.ts +3 -0
- package/dist/core/stdlib/proto.d.ts.map +1 -0
- package/dist/core/stdlib/shared.d.ts +24 -0
- package/dist/core/stdlib/shared.d.ts.map +1 -0
- package/dist/core/stdlib/strings.d.ts +3 -0
- package/dist/core/stdlib/strings.d.ts.map +1 -0
- package/dist/core/stdlib/verify.d.ts +3 -0
- package/dist/core/stdlib/verify.d.ts.map +1 -0
- package/dist/core/util.d.ts +9 -0
- package/dist/core/util.d.ts.map +1 -0
- package/dist/core/values.d.ts +47 -0
- package/dist/core/values.d.ts.map +1 -0
- package/dist/core/virtual-module-resolver.d.ts +14 -0
- package/dist/core/virtual-module-resolver.d.ts.map +1 -0
- package/dist/hosts/browser/index.d.ts +3 -0
- package/dist/hosts/browser/index.d.ts.map +1 -0
- package/dist/hosts/node/cli-utils.d.ts +18 -0
- package/dist/hosts/node/cli-utils.d.ts.map +1 -0
- package/dist/hosts/node/cli.d.ts +2 -0
- package/dist/hosts/node/cli.d.ts.map +1 -0
- package/dist/hosts/node/dev-repl.d.ts +2 -0
- package/dist/hosts/node/dev-repl.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/ranty.js +9268 -0
- package/dist/ranty.js.map +1 -0
- package/docs/README.md +24 -0
- package/docs/context-system/README.md +85 -0
- package/docs/repo-workflow/README.md +40 -0
- package/package.json +90 -0
package/docs/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Ranty.js Docs
|
|
2
|
+
|
|
3
|
+
The shared product reference for Ranty lives at
|
|
4
|
+
<https://insanityfarm.github.io/ranty/>. The local JS-specific package,
|
|
5
|
+
browser, host-integration, and CLI notes live in [`../README.md`](../README.md).
|
|
6
|
+
|
|
7
|
+
The authoritative implementation and workflow contract lives in
|
|
8
|
+
[`../spec/README.md`](../spec/README.md). The authoritative terminology
|
|
9
|
+
lives in [`../glossary/README.md`](../glossary/README.md). Future-facing
|
|
10
|
+
follow-up lives in [`../notes.md`](../notes.md).
|
|
11
|
+
|
|
12
|
+
## Product Docs
|
|
13
|
+
|
|
14
|
+
- [Hosted Ranty Reference](https://insanityfarm.github.io/ranty/): shared
|
|
15
|
+
language, stdlib, modules, runtime, and CLI reference
|
|
16
|
+
- [`../README.md`](../README.md): Ranty.js-specific package, browser, Node, and
|
|
17
|
+
host-integration details
|
|
18
|
+
|
|
19
|
+
## Workflow Docs
|
|
20
|
+
|
|
21
|
+
- [`./context-system/README.md`](./context-system/README.md): anti-drift task
|
|
22
|
+
briefing, locked-subsystem policy, generated artifacts, and review packets
|
|
23
|
+
- [`./repo-workflow/README.md`](./repo-workflow/README.md): repo-wide git and
|
|
24
|
+
`notes.md` workflow rules
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Context System Guide
|
|
2
|
+
|
|
3
|
+
This guide covers the anti-drift context system that keeps architecture memory
|
|
4
|
+
compact, queryable, and local to the repository. The implemented behavior still
|
|
5
|
+
lives in [`../../spec/README.md`](../../spec/README.md), and the authoritative
|
|
6
|
+
terminology still lives in [`../../glossary/README.md`](../../glossary/README.md).
|
|
7
|
+
|
|
8
|
+
## What This System Owns
|
|
9
|
+
|
|
10
|
+
- task briefing for blank-context sessions
|
|
11
|
+
- subsystem boundaries, invariants, and history anchors
|
|
12
|
+
- locked-subsystem edit policy
|
|
13
|
+
- terminology enforcement based on the glossary source data
|
|
14
|
+
- generated repo topology artifacts for review and exploration
|
|
15
|
+
|
|
16
|
+
## Start A Task
|
|
17
|
+
|
|
18
|
+
1. Read `spec/README.md`.
|
|
19
|
+
2. Read `glossary/README.md`.
|
|
20
|
+
3. Run `npm run context:task -- "<task>"`.
|
|
21
|
+
4. Read `.agent-context/active-task.md`.
|
|
22
|
+
5. Follow the listed subsystem records, spec pages, docs, ADRs, and tests before editing.
|
|
23
|
+
|
|
24
|
+
The active task packet is repo-local and gitignored. `npm run context:check`
|
|
25
|
+
uses it to make sure current work stays inside the planned subsystem surface.
|
|
26
|
+
|
|
27
|
+
## Locked Subsystems
|
|
28
|
+
|
|
29
|
+
Locked subsystems are architecture or contract-sensitive seams. They fail
|
|
30
|
+
closed by default.
|
|
31
|
+
|
|
32
|
+
If a task must edit locked subsystem code:
|
|
33
|
+
|
|
34
|
+
1. confirm the need to cross that seam
|
|
35
|
+
2. rerun `npm run context:task -- "<task>" --allow-locked=subsystem-id`
|
|
36
|
+
3. update the touched subsystem record and a related ADR in the same change
|
|
37
|
+
|
|
38
|
+
If the task can stay above the seam, leave the locked subsystem untouched.
|
|
39
|
+
|
|
40
|
+
## Choose The Right Artifact
|
|
41
|
+
|
|
42
|
+
Add or update a glossary term when:
|
|
43
|
+
|
|
44
|
+
- the concept is cross-cutting across multiple subsystems
|
|
45
|
+
- exact wording matters enough that synonym drift would be harmful
|
|
46
|
+
|
|
47
|
+
Add or update a subsystem invariant when:
|
|
48
|
+
|
|
49
|
+
- the behavior is architectural or contract-sensitive
|
|
50
|
+
- a future session could accidentally violate it while editing nearby code
|
|
51
|
+
|
|
52
|
+
Add or update an ADR when:
|
|
53
|
+
|
|
54
|
+
- the change revises why the system is shaped this way
|
|
55
|
+
- a locked-subsystem policy or architecture decision changed
|
|
56
|
+
- the task needs durable rationale that should survive code churn
|
|
57
|
+
|
|
58
|
+
Do not stuff subsystem-local jargon into the glossary unless it truly became a
|
|
59
|
+
repo-wide term.
|
|
60
|
+
|
|
61
|
+
## Generate And Check
|
|
62
|
+
|
|
63
|
+
- `npm run context:build`: regenerate `glossary/README.md` and files under `spec/generated/`
|
|
64
|
+
- `npm run terms:check`: reject discouraged glossary replacements
|
|
65
|
+
- `npm run arch:check`: enforce import-boundary rules
|
|
66
|
+
- `npm run context:check`: enforce active-task coverage, locked-subsystem policy, and generated-artifact freshness
|
|
67
|
+
- `npm run drift:review`: write `.agent-context/drift-review.md` for a second review session
|
|
68
|
+
|
|
69
|
+
Treat `context:build` like other derived-artifact generators in the repo: edit
|
|
70
|
+
the source files first, regenerate immediately, then continue with tests or
|
|
71
|
+
follow-up work.
|
|
72
|
+
|
|
73
|
+
## Review Packet Flow
|
|
74
|
+
|
|
75
|
+
Run `npm run drift:review` near the end of a task when you want a second review
|
|
76
|
+
session to check for drift. The packet includes:
|
|
77
|
+
|
|
78
|
+
- the active task summary
|
|
79
|
+
- changed files
|
|
80
|
+
- touched subsystems
|
|
81
|
+
- the invariants that matter most for those subsystems
|
|
82
|
+
- changed authoritative artifacts
|
|
83
|
+
|
|
84
|
+
The review packet is a bounded summary for reviewers. It is not a second source
|
|
85
|
+
of truth.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Repository Workflow
|
|
2
|
+
|
|
3
|
+
This guide covers repo-wide contributor workflow that is not specific to one
|
|
4
|
+
subsystem. The implemented contract still lives in
|
|
5
|
+
[`../../spec/README.md`](../../spec/README.md).
|
|
6
|
+
|
|
7
|
+
## Git Commits
|
|
8
|
+
|
|
9
|
+
When a task includes creating a commit:
|
|
10
|
+
|
|
11
|
+
1. Inspect recent history first with a non-interactive command such as
|
|
12
|
+
`git log --oneline -n 10`.
|
|
13
|
+
2. Match the commit message tone, structure, and level of detail used by the
|
|
14
|
+
current repository history.
|
|
15
|
+
3. Prefer non-interactive git commands throughout the workflow.
|
|
16
|
+
4. If both `git add` and `git commit` are part of the task, run them
|
|
17
|
+
sequentially instead of in parallel so the index lock stays predictable.
|
|
18
|
+
|
|
19
|
+
Do not treat commit messages as a place to explain implementation details that
|
|
20
|
+
belong in spec pages, ADRs, or subsystem records.
|
|
21
|
+
|
|
22
|
+
## `notes.md`
|
|
23
|
+
|
|
24
|
+
[`../../notes.md`](../../notes.md) is intentionally non-authoritative. Use it
|
|
25
|
+
for durable future-facing material such as:
|
|
26
|
+
|
|
27
|
+
- buildout ideas
|
|
28
|
+
- follow-through reminders
|
|
29
|
+
- open design questions that do not describe current implemented behavior
|
|
30
|
+
|
|
31
|
+
Do not duplicate current behavior, architecture contracts, or recurring
|
|
32
|
+
workflow instructions in `notes.md`. Those belong in `spec/` or `docs/`.
|
|
33
|
+
|
|
34
|
+
When a task creates or resolves durable future-facing follow-through:
|
|
35
|
+
|
|
36
|
+
1. update `notes.md` if the reminder is still useful after the current task
|
|
37
|
+
2. remove entries that are stale, completed, or superseded
|
|
38
|
+
|
|
39
|
+
If a note becomes part of implemented behavior or a standing workflow, move it
|
|
40
|
+
out of `notes.md` and into the authoritative home.
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ranty-js",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Ranty.js - JavaScript port of the Ranty procedural templating language",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/insanityfarm/ranty-js.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/insanityfarm/ranty-js",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/insanityfarm/ranty-js/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ranty",
|
|
16
|
+
"templating",
|
|
17
|
+
"procedural",
|
|
18
|
+
"generation",
|
|
19
|
+
"procgen"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/ranty.js",
|
|
22
|
+
"browser": "./dist/ranty.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"unpkg": "./dist/ranty.js",
|
|
25
|
+
"jsdelivr": "./dist/ranty.js",
|
|
26
|
+
"bin": {
|
|
27
|
+
"ranty-js": "./dist/ranty.js"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/ranty.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md",
|
|
38
|
+
"docs"
|
|
39
|
+
],
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=22.0.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"arch:check": "node ./scripts/context-system/architecture.mjs",
|
|
45
|
+
"bench": "npm run build && bash benchmarks/run-hyperfine.sh",
|
|
46
|
+
"build": "npm run clean && rollup -c && tsc -p tsconfig.build.json",
|
|
47
|
+
"check": "npm run lint && npm run format:check && npm run typecheck && npm run test && npm run arch:check && npm run context:check",
|
|
48
|
+
"clean": "rimraf dist coverage",
|
|
49
|
+
"context:build": "node ./scripts/context-system/build.mjs",
|
|
50
|
+
"context:check": "node ./scripts/context-system/check.mjs",
|
|
51
|
+
"context:task": "node ./scripts/context-system/task.mjs",
|
|
52
|
+
"dev": "rollup -c -w",
|
|
53
|
+
"dev:repl": "tsx src/hosts/node/dev-repl.ts",
|
|
54
|
+
"drift:review": "node ./scripts/context-system/review.mjs",
|
|
55
|
+
"format": "prettier --write .",
|
|
56
|
+
"format:check": "prettier --check .",
|
|
57
|
+
"lint": "npm run lint:eslint && npm run lint:directives && npm run terms:check",
|
|
58
|
+
"lint:directives": "node ./scripts/check-eslint-directives.mjs",
|
|
59
|
+
"lint:eslint": "eslint . --max-warnings 0",
|
|
60
|
+
"lint:fix": "eslint . --fix",
|
|
61
|
+
"terms:check": "node ./scripts/context-system/terms.mjs",
|
|
62
|
+
"test": "npm run build && vitest run",
|
|
63
|
+
"test:unit": "vitest run",
|
|
64
|
+
"test:watch": "vitest",
|
|
65
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
66
|
+
"upstream:check-freshness": "node ./scripts/upstream/check-freshness.mjs",
|
|
67
|
+
"upstream:sync": "node ./scripts/upstream/sync-ranty.mjs",
|
|
68
|
+
"verify": "npm run check && npm run build"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@eslint/js": "^9.23.0",
|
|
72
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
73
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
74
|
+
"@types/node": "^22.13.13",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
76
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
77
|
+
"eslint": "^9.23.0",
|
|
78
|
+
"eslint-config-prettier": "^10.1.1",
|
|
79
|
+
"globals": "^16.0.0",
|
|
80
|
+
"js-yaml": "^4.1.0",
|
|
81
|
+
"jsdom": "^26.0.0",
|
|
82
|
+
"prettier": "^3.5.3",
|
|
83
|
+
"rimraf": "^6.0.1",
|
|
84
|
+
"rollup": "^4.36.0",
|
|
85
|
+
"rollup-plugin-esbuild": "^6.2.1",
|
|
86
|
+
"tsx": "^4.19.3",
|
|
87
|
+
"typescript": "^5.8.2",
|
|
88
|
+
"vitest": "^3.1.1"
|
|
89
|
+
}
|
|
90
|
+
}
|