dirac-lang 0.1.24 → 0.1.25
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/dist/cli.js +13 -1
- package/lib/index.di +9 -0
- package/package.json +13 -1
- package/.env.example +0 -8
- package/COMMUNITY.md +0 -465
- package/CONDITIONAL-TAGS.md +0 -172
- package/EXCEPTION-HANDLING.md +0 -156
- package/LIBRARIES.md +0 -172
- package/LLM-VALIDATION.md +0 -128
- package/NAMESPACES.md +0 -366
- package/PROMOTION.md +0 -257
- package/QUICKSTART-LIBRARY.md +0 -93
- package/TEST-COVERAGE.md +0 -113
- package/TESTING.md +0 -162
- package/config.test.yml +0 -5
- package/dirac-http/examples/demo.di +0 -9
- package/dirac-http/lib/index.di +0 -12
- package/examples/add-demo.di +0 -74
- package/examples/add.bk +0 -11
- package/examples/advanced-math-demo.di +0 -53
- package/examples/calculator.di +0 -32
- package/examples/compact-test.di +0 -6
- package/examples/comprehensive.bk +0 -29
- package/examples/defvar-variable-demo.di +0 -18
- package/examples/direct-call.di +0 -17
- package/examples/disk-analysis.di +0 -16
- package/examples/exception-demo.di +0 -82
- package/examples/executable-hello.di +0 -7
- package/examples/execute-demo.di +0 -38
- package/examples/file-manager.di +0 -77
- package/examples/file-stats.di +0 -18
- package/examples/hello.bk +0 -1
- package/examples/hello.di +0 -5
- package/examples/if-comparison.di +0 -91
- package/examples/if-cstyle-test.di +0 -149
- package/examples/if-vs-testif.di +0 -56
- package/examples/import-demo.di +0 -31
- package/examples/inline-test.bk +0 -7
- package/examples/llm-agent.di +0 -32
- package/examples/llm-basic.di +0 -12
- package/examples/llm-command-more.di +0 -6
- package/examples/llm-command-no-exec.di +0 -13
- package/examples/llm-command.di +0 -6
- package/examples/llm-complex.di +0 -141
- package/examples/llm-feedback-debug.di +0 -30
- package/examples/llm-feedback-demo.di +0 -19
- package/examples/llm-feedback-math.di +0 -22
- package/examples/llm-feedback-simple.di +0 -16
- package/examples/llm-feedback-sub.di +0 -22
- package/examples/llm-no-feedback.di +0 -10
- package/examples/llm-recursive.di +0 -31
- package/examples/llm-reflection-test.di +0 -19
- package/examples/llm-simple-test.di +0 -12
- package/examples/llm-subs.di +0 -132
- package/examples/llm-use-subs.di +0 -6
- package/examples/llm-validate-test.di +0 -18
- package/examples/loop.di +0 -12
- package/examples/math-test.di +0 -22
- package/examples/minimal-test.di +0 -13
- package/examples/mongodb-context-test.di +0 -27
- package/examples/mongodb-count-events.di +0 -8
- package/examples/mongodb-import-demo.di +0 -25
- package/examples/mongodb-simple-test.di +0 -18
- package/examples/nl-agent.di +0 -47
- package/examples/parameters-demo.di +0 -68
- package/examples/params-meta-test.di +0 -17
- package/examples/params-test.di +0 -10
- package/examples/recipe-chain.di +0 -38
- package/examples/recursive-llm.di +0 -44
- package/examples/sample-library/README.md +0 -152
- package/examples/sample-library/examples/demo.di +0 -34
- package/examples/sample-library/lib/index.di +0 -65
- package/examples/sample-library/package.json +0 -31
- package/examples/scope-test-nested.di +0 -60
- package/examples/scope-test.di +0 -55
- package/examples/seamless.di +0 -45
- package/examples/shell-test.bk +0 -10
- package/examples/simple-import.di +0 -13
- package/examples/simple-recursive.di +0 -26
- package/examples/story-builder.di +0 -45
- package/examples/subroutine.di +0 -23
- package/examples/system-llm.di +0 -21
- package/examples/system-simple.di +0 -3
- package/examples/system-test.di +0 -8
- package/examples/tag-check-test.di +0 -139
- package/examples/task-assistant.di +0 -27
- package/examples/test-if-demo.di +0 -110
- package/examples/test-parameters.di +0 -50
- package/examples/try-catch-test.di +0 -118
- package/examples/two-styles.di +0 -28
- package/examples/var-debug.di +0 -6
- package/examples/var-inline.di +0 -4
- package/examples/var-test2.di +0 -6
- package/examples/variable-replace.di +0 -25
- package/examples/variable-simple.di +0 -16
- package/examples/variable-test.di +0 -22
- package/examples/whitespace-test.di +0 -24
- package/filePath +0 -1
- package/greeting.txt +0 -1
- package/src/cli.ts +0 -140
- package/src/index.ts +0 -33
- package/src/llm/ollama.ts +0 -58
- package/src/runtime/braket-parser.ts +0 -234
- package/src/runtime/interpreter.ts +0 -203
- package/src/runtime/parser.ts +0 -155
- package/src/runtime/session.ts +0 -325
- package/src/tags/assign.ts +0 -37
- package/src/tags/attr.ts +0 -64
- package/src/tags/available-subroutines.ts +0 -70
- package/src/tags/call.ts +0 -259
- package/src/tags/catch.ts +0 -24
- package/src/tags/defvar.ts +0 -115
- package/src/tags/environment.ts +0 -21
- package/src/tags/eval.ts +0 -71
- package/src/tags/exception.ts +0 -20
- package/src/tags/execute.ts +0 -52
- package/src/tags/expr.ts +0 -128
- package/src/tags/foreach.ts +0 -170
- package/src/tags/if.ts +0 -191
- package/src/tags/import.ts +0 -135
- package/src/tags/index.ts +0 -41
- package/src/tags/input.ts +0 -182
- package/src/tags/llm.ts +0 -415
- package/src/tags/loop.ts +0 -43
- package/src/tags/mongodb.ts +0 -70
- package/src/tags/output.ts +0 -53
- package/src/tags/parameters.ts +0 -81
- package/src/tags/require_module.ts +0 -19
- package/src/tags/subroutine.ts +0 -75
- package/src/tags/system.ts +0 -93
- package/src/tags/tag-check.ts +0 -176
- package/src/tags/test-if.ts +0 -112
- package/src/tags/throw.ts +0 -26
- package/src/tags/try.ts +0 -19
- package/src/tags/variable.ts +0 -25
- package/src/test-runner.ts +0 -300
- package/src/types/index.ts +0 -128
- package/src/utils/llm-adapter.ts +0 -113
- package/src/utils/tag-validator.ts +0 -231
- package/test-available-extends.di +0 -28
- package/test-available-simple.di +0 -12
- package/test-available-subroutines.di +0 -16
- package/test-call.di +0 -9
- package/test-extend-basic.di +0 -17
- package/test-extend-chain.di +0 -26
- package/test-extend-debug.di +0 -17
- package/test-extend-debug2.di +0 -15
- package/test-extend-person.di +0 -17
- package/test-extend-simple.di +0 -11
- package/test-extend-zhi.di +0 -23
- package/test-extend.di +0 -19
- package/test-extend2.di +0 -26
- package/test-extend3-fixed.di +0 -23
- package/test-extend3-trouble.di +0 -23
- package/test-extend3.di +0 -21
- package/test-factorial.di +0 -19
- package/test-input-debug.di +0 -19
- package/test-nested-debug.di +0 -7
- package/test-nested-debug2.di +0 -8
- package/test-no-extend.di +0 -16
- package/test-simple-call.di +0 -7
- package/test-simple.di +0 -6
- package/tests/README.md +0 -69
- package/tests/assign-basic.test.di +0 -7
- package/tests/assign-from-eval.test.di +0 -7
- package/tests/available-subroutines-foreach.test.di +0 -32
- package/tests/basic-output.test.di +0 -5
- package/tests/call-basic.test.di +0 -11
- package/tests/call-with-output.test.di +0 -10
- package/tests/comments-before-content.test.di +0 -6
- package/tests/defvar-multiple.test.di +0 -8
- package/tests/environment-basic.test.di +0 -22
- package/tests/environment-nonexistent.test.di +0 -5
- package/tests/environment-with-defvar.test.di +0 -15
- package/tests/eval-basic.test.di +0 -6
- package/tests/eval-with-variables.test.di +0 -8
- package/tests/exception-basic.test.di +0 -10
- package/tests/expr-basic.test.di +0 -11
- package/tests/extend-basic.test.di +0 -19
- package/tests/extend-inheritance-chain.test.di +0 -26
- package/tests/extend-multiple-nested.test.di +0 -24
- package/tests/extend-self.test.di +0 -19
- package/tests/extend-with-parameters.test.di +0 -14
- package/tests/generate-dirac.test.di +0 -22
- package/tests/if-conditional.test.di +0 -17
- package/tests/if-else.test.di +0 -11
- package/tests/if-with-variables.test.di +0 -8
- package/tests/import-basic.test.di +0 -6
- package/tests/input-file-all.test.di +0 -5
- package/tests/input-file-line.test.di +0 -15
- package/tests/input-file-loop.test.di +0 -12
- package/tests/input-stdin-all.test.di +0 -8
- package/tests/input-stdin-all.txt +0 -1
- package/tests/llm-validate.test.di +0 -17
- package/tests/loop-basic.test.di +0 -9
- package/tests/loop-nested.test.di +0 -10
- package/tests/loop-with-eval.test.di +0 -8
- package/tests/no-root-element.test.di +0 -6
- package/tests/output-file.test.di +0 -19
- package/tests/output-multiple.test.di +0 -9
- package/tests/parameters-basic.test.di +0 -6
- package/tests/require-module-basic.test.di +0 -7
- package/tests/subroutine-basic.test.di +0 -9
- package/tests/subroutine-multiple-params.test.di +0 -10
- package/tests/subroutine-nested-calls.test.di +0 -32
- package/tests/subroutine-sequential-calls.test.di +0 -36
- package/tests/system-background.test.di +0 -39
- package/tests/system-basic.test.di +0 -5
- package/tests/tag-check.test.di +0 -27
- package/tests/test-if-basic.test.di +0 -8
- package/tests/test-input.txt +0 -3
- package/tests/try-catch-basic.test.di +0 -10
- package/tests/try-catch-eval-error.test.di +0 -10
- package/tests/variable-basic.test.di +0 -6
- package/tests/variable-interpolation.test.di +0 -7
- package/tools/create-library.sh +0 -175
- package/tsconfig.json +0 -19
- /package/{examples/lib → lib}/advanced-math.di +0 -0
- /package/{examples/lib → lib}/fileops.di +0 -0
- /package/{examples/lib → lib}/math.di +0 -0
- /package/{examples/lib → lib}/mongodb.di +0 -0
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import "dotenv/config";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "dirac-lang",
|
|
16
|
-
version: "0.1.
|
|
16
|
+
version: "0.1.25",
|
|
17
17
|
description: "LLM-Augmented Declarative Execution",
|
|
18
18
|
type: "module",
|
|
19
19
|
main: "dist/index.js",
|
|
@@ -21,6 +21,18 @@ var package_default = {
|
|
|
21
21
|
bin: {
|
|
22
22
|
dirac: "dist/cli.js"
|
|
23
23
|
},
|
|
24
|
+
exports: {
|
|
25
|
+
".": "./dist/index.js",
|
|
26
|
+
"./lib": "./lib/index.di",
|
|
27
|
+
"./lib/math": "./lib/math.di",
|
|
28
|
+
"./lib/advanced-math": "./lib/advanced-math.di",
|
|
29
|
+
"./lib/fileops": "./lib/fileops.di",
|
|
30
|
+
"./lib/mongodb": "./lib/mongodb.di"
|
|
31
|
+
},
|
|
32
|
+
files: [
|
|
33
|
+
"dist/",
|
|
34
|
+
"lib/"
|
|
35
|
+
],
|
|
24
36
|
scripts: {
|
|
25
37
|
dev: "tsx src/cli.ts",
|
|
26
38
|
build: "tsup src/index.ts src/cli.ts src/test-runner.ts --format esm --dts --clean",
|
package/lib/index.di
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirac-lang",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "LLM-Augmented Declarative Execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
"bin": {
|
|
9
9
|
"dirac": "dist/cli.js"
|
|
10
10
|
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./dist/index.js",
|
|
13
|
+
"./lib": "./lib/index.di",
|
|
14
|
+
"./lib/math": "./lib/math.di",
|
|
15
|
+
"./lib/advanced-math": "./lib/advanced-math.di",
|
|
16
|
+
"./lib/fileops": "./lib/fileops.di",
|
|
17
|
+
"./lib/mongodb": "./lib/mongodb.di"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist/",
|
|
21
|
+
"lib/"
|
|
22
|
+
],
|
|
11
23
|
"scripts": {
|
|
12
24
|
"dev": "tsx src/cli.ts",
|
|
13
25
|
"build": "tsup src/index.ts src/cli.ts src/test-runner.ts --format esm --dts --clean",
|
package/.env.example
DELETED
package/COMMUNITY.md
DELETED
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
# Dirac Community Library Ecosystem
|
|
2
|
-
|
|
3
|
-
## Publishing a Library
|
|
4
|
-
|
|
5
|
-
### Step 1: Create Your Library
|
|
6
|
-
|
|
7
|
-
Create a repository structure:
|
|
8
|
-
```
|
|
9
|
-
my-dirac-library/
|
|
10
|
-
├── package.json # npm metadata
|
|
11
|
-
├── README.md # Documentation
|
|
12
|
-
├── lib/
|
|
13
|
-
│ ├── main.di # Your subroutines
|
|
14
|
-
│ └── utils.di # Helper functions
|
|
15
|
-
├── examples/
|
|
16
|
-
│ └── demo.di # Usage examples
|
|
17
|
-
└── tests/
|
|
18
|
-
└── test.di # Tests
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Step 2: Follow Naming Convention
|
|
22
|
-
|
|
23
|
-
**CRITICAL: Prevent conflicts with prefixes**
|
|
24
|
-
|
|
25
|
-
All library tags MUST use a prefix:
|
|
26
|
-
- Package: `dirac-http` → Prefix: `HTTP_`
|
|
27
|
-
- Package: `dirac-crypto` → Prefix: `CRYPTO_`
|
|
28
|
-
- Example: `<HTTP_GET/>`, `<CRYPTO_SHA256/>`
|
|
29
|
-
|
|
30
|
-
### Step 3: Add package.json
|
|
31
|
-
|
|
32
|
-
```json
|
|
33
|
-
{
|
|
34
|
-
"name": "dirac-crypto",
|
|
35
|
-
"version": "1.0.0",
|
|
36
|
-
"description": "Cryptography library for Dirac",
|
|
37
|
-
"main": "lib/main.di",
|
|
38
|
-
"keywords": ["dirac", "crypto", "hash"],
|
|
39
|
-
"author": "Your Name",
|
|
40
|
-
"license": "MIT",
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "https://github.com/username/dirac-crypto"
|
|
44
|
-
},
|
|
45
|
-
"dirac": {
|
|
46
|
-
"version": ">=0.1.0",
|
|
47
|
-
"exports": {
|
|
48
|
-
"main": "lib/main.di",
|
|
49
|
-
"utils": "lib/utils.di"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Step 3: Publish
|
|
57
|
-
|
|
58
|
-
#### Option A: npm (Recommended)
|
|
59
|
-
```bash
|
|
60
|
-
npm login
|
|
61
|
-
npm publish
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Users install:
|
|
65
|
-
```bash
|
|
66
|
-
npm install dirac-crypto
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Use:
|
|
70
|
-
```xml
|
|
71
|
-
<import src="./node_modules/dirac-crypto/lib/main.di"/>
|
|
72
|
-
<SHA256 text="hello world"/>
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
#### Option B: GitHub
|
|
76
|
-
```bash
|
|
77
|
-
git tag v1.0.0
|
|
78
|
-
git push --tags
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Users install:
|
|
82
|
-
```bash
|
|
83
|
-
npm install github:username/dirac-crypto
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
#### Option C: Dirac Registry (Future)
|
|
87
|
-
```bash
|
|
88
|
-
dirac publish
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Users install:
|
|
92
|
-
```bash
|
|
93
|
-
dirac install crypto
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Use:
|
|
97
|
-
```xml
|
|
98
|
-
<import src="@dirac/crypto/main"/>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Discovery Mechanisms
|
|
102
|
-
|
|
103
|
-
### 1. npm with "dirac-" prefix
|
|
104
|
-
|
|
105
|
-
Convention: All Dirac libraries use `dirac-` prefix:
|
|
106
|
-
- `dirac-http` - HTTP client
|
|
107
|
-
- `dirac-db` - Database operations
|
|
108
|
-
- `dirac-ml` - Machine learning
|
|
109
|
-
- `dirac-crypto` - Cryptography
|
|
110
|
-
|
|
111
|
-
Search on npm:
|
|
112
|
-
```bash
|
|
113
|
-
npm search dirac-
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### 2. GitHub Topics
|
|
117
|
-
|
|
118
|
-
Tag repos with:
|
|
119
|
-
- `dirac`
|
|
120
|
-
- `dirac-library`
|
|
121
|
-
- `mask-language`
|
|
122
|
-
|
|
123
|
-
Browse: https://github.com/topics/dirac-library
|
|
124
|
-
|
|
125
|
-
### 3. Central Registry Website
|
|
126
|
-
|
|
127
|
-
Create `diraclibs.org`:
|
|
128
|
-
- **Browse** libraries by category
|
|
129
|
-
- **Search** by functionality
|
|
130
|
-
- **Ratings** and downloads
|
|
131
|
-
- **Documentation** for each library
|
|
132
|
-
- **Examples** and tutorials
|
|
133
|
-
|
|
134
|
-
### 4. CLI Discovery
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
dirac search "http client"
|
|
138
|
-
dirac info dirac-http
|
|
139
|
-
dirac install dirac-http
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Quality Standards
|
|
143
|
-
|
|
144
|
-
### Verified Libraries
|
|
145
|
-
|
|
146
|
-
Libraries can be "verified" by passing:
|
|
147
|
-
|
|
148
|
-
1. **Tests** - Automated test suite
|
|
149
|
-
2. **Documentation** - README with examples
|
|
150
|
-
3. **Compatibility** - Works with current Dirac version
|
|
151
|
-
4. **Security** - No malicious code (automated scan)
|
|
152
|
-
5. **Community** - Downloads, stars, issues resolved
|
|
153
|
-
|
|
154
|
-
Badge in README:
|
|
155
|
-
```markdown
|
|
156
|
-

|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Library Template
|
|
160
|
-
|
|
161
|
-
Provide starter template:
|
|
162
|
-
```bash
|
|
163
|
-
dirac create-lib my-library
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Generates:
|
|
167
|
-
```
|
|
168
|
-
my-library/
|
|
169
|
-
├── package.json
|
|
170
|
-
├── README.md
|
|
171
|
-
├── lib/
|
|
172
|
-
│ └── index.di
|
|
173
|
-
├── examples/
|
|
174
|
-
│ └── example.di
|
|
175
|
-
├── tests/
|
|
176
|
-
│ └── test.di
|
|
177
|
-
└── .github/
|
|
178
|
-
└── workflows/
|
|
179
|
-
└── test.yml # Auto-test on push
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## Version Management
|
|
183
|
-
|
|
184
|
-
### Semantic Versioning
|
|
185
|
-
|
|
186
|
-
Follow semver for library versions:
|
|
187
|
-
- `1.0.0` - Initial release
|
|
188
|
-
- `1.1.0` - New subroutines (backward compatible)
|
|
189
|
-
- `2.0.0` - Breaking changes
|
|
190
|
-
|
|
191
|
-
### Dependency Resolution
|
|
192
|
-
|
|
193
|
-
In `package.json`:
|
|
194
|
-
```json
|
|
195
|
-
{
|
|
196
|
-
"dirac": {
|
|
197
|
-
"dependencies": {
|
|
198
|
-
"dirac-utils": "^1.0.0",
|
|
199
|
-
"dirac-http": "^2.1.0"
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
Install with:
|
|
206
|
-
```bash
|
|
207
|
-
npm install
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Import from Dependencies
|
|
211
|
-
|
|
212
|
-
```xml
|
|
213
|
-
<!-- Import from node_modules -->
|
|
214
|
-
<import src="./node_modules/dirac-http/lib/main.di"/>
|
|
215
|
-
|
|
216
|
-
<!-- Or use a helper tag (future) -->
|
|
217
|
-
<import package="dirac-http"/>
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
## Community Governance
|
|
221
|
-
|
|
222
|
-
### 1. Core Standard Library
|
|
223
|
-
|
|
224
|
-
Official libraries maintained by Dirac team:
|
|
225
|
-
- `@dirac/stdlib` - Standard library
|
|
226
|
-
- `@dirac/test` - Testing framework
|
|
227
|
-
- `@dirac/docs` - Documentation generator
|
|
228
|
-
|
|
229
|
-
Published under `@dirac` scope on npm.
|
|
230
|
-
|
|
231
|
-
### 2. Community Libraries
|
|
232
|
-
|
|
233
|
-
Anyone can publish `dirac-*` packages:
|
|
234
|
-
- Use npm's existing infrastructure
|
|
235
|
-
- No approval needed
|
|
236
|
-
- Free innovation
|
|
237
|
-
|
|
238
|
-
### 3. Awesome List
|
|
239
|
-
|
|
240
|
-
Maintain `awesome-dirac` repo:
|
|
241
|
-
```markdown
|
|
242
|
-
# Awesome Dirac
|
|
243
|
-
|
|
244
|
-
## HTTP & Networking
|
|
245
|
-
- [dirac-http](https://github.com/user/dirac-http) - HTTP client
|
|
246
|
-
- [dirac-websocket](https://github.com/user/dirac-ws) - WebSocket
|
|
247
|
-
|
|
248
|
-
## Data Processing
|
|
249
|
-
- [dirac-json](https://github.com/user/dirac-json) - JSON parser
|
|
250
|
-
- [dirac-csv](https://github.com/user/dirac-csv) - CSV operations
|
|
251
|
-
|
|
252
|
-
## Machine Learning
|
|
253
|
-
- [dirac-ml](https://github.com/user/dirac-ml) - ML toolkit
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### 4. Discord/Forum
|
|
257
|
-
|
|
258
|
-
Community channels:
|
|
259
|
-
- **#library-showcase** - Share new libraries
|
|
260
|
-
- **#help** - Get support
|
|
261
|
-
- **#development** - Discuss features
|
|
262
|
-
- **#security** - Report issues
|
|
263
|
-
|
|
264
|
-
## Example: Publishing dirac-http
|
|
265
|
-
|
|
266
|
-
### 1. Create Library
|
|
267
|
-
|
|
268
|
-
`lib/main.di`:
|
|
269
|
-
```xml
|
|
270
|
-
<dirac>
|
|
271
|
-
|
|
272
|
-
<subroutine name="HTTP_GET">
|
|
273
|
-
<eval>
|
|
274
|
-
const caller = getParams();
|
|
275
|
-
const url = caller.attributes.url;
|
|
276
|
-
const response = await fetch(url);
|
|
277
|
-
const text = await response.text();
|
|
278
|
-
console.log(text);
|
|
279
|
-
</eval>
|
|
280
|
-
</subroutine>
|
|
281
|
-
|
|
282
|
-
<subroutine name="HTTP_POST">
|
|
283
|
-
<eval>
|
|
284
|
-
const caller = getParams();
|
|
285
|
-
const url = caller.attributes.url;
|
|
286
|
-
const body = caller.attributes.body || '';
|
|
287
|
-
const response = await fetch(url, {
|
|
288
|
-
method: 'POST',
|
|
289
|
-
body: body
|
|
290
|
-
});
|
|
291
|
-
const text = await response.text();
|
|
292
|
-
console.log(text);
|
|
293
|
-
</eval>
|
|
294
|
-
</subroutine>
|
|
295
|
-
|
|
296
|
-
</dirac>
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### 2. Create package.json
|
|
300
|
-
|
|
301
|
-
```json
|
|
302
|
-
{
|
|
303
|
-
"name": "dirac-http",
|
|
304
|
-
"version": "1.0.0",
|
|
305
|
-
"description": "HTTP client for Dirac",
|
|
306
|
-
"main": "lib/main.di",
|
|
307
|
-
"keywords": ["dirac", "http", "fetch", "rest"],
|
|
308
|
-
"author": "Community Member",
|
|
309
|
-
"license": "MIT",
|
|
310
|
-
"repository": "github:username/dirac-http",
|
|
311
|
-
"dirac": {
|
|
312
|
-
"version": ">=0.1.0"
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
### 3. Create README.md
|
|
318
|
-
|
|
319
|
-
```markdown
|
|
320
|
-
# dirac-http
|
|
321
|
-
|
|
322
|
-
HTTP client library for Dirac.
|
|
323
|
-
|
|
324
|
-
## Installation
|
|
325
|
-
|
|
326
|
-
\`\`\`bash
|
|
327
|
-
npm install dirac-http
|
|
328
|
-
\`\`\`
|
|
329
|
-
|
|
330
|
-
## Usage
|
|
331
|
-
|
|
332
|
-
\`\`\`xml
|
|
333
|
-
<import src="./node_modules/dirac-http/lib/main.di"/>
|
|
334
|
-
|
|
335
|
-
<HTTP_GET url="https://api.github.com/users/octocat"/>
|
|
336
|
-
|
|
337
|
-
<HTTP_POST
|
|
338
|
-
url="https://httpbin.org/post"
|
|
339
|
-
body='{"key":"value"}'/>
|
|
340
|
-
\`\`\`
|
|
341
|
-
|
|
342
|
-
## API
|
|
343
|
-
|
|
344
|
-
### HTTP_GET
|
|
345
|
-
Get a URL.
|
|
346
|
-
|
|
347
|
-
**Attributes:**
|
|
348
|
-
- `url` - URL to fetch (required)
|
|
349
|
-
|
|
350
|
-
### HTTP_POST
|
|
351
|
-
Post to a URL.
|
|
352
|
-
|
|
353
|
-
**Attributes:**
|
|
354
|
-
- `url` - URL to post to (required)
|
|
355
|
-
- `body` - Request body (optional)
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
### 4. Publish
|
|
359
|
-
|
|
360
|
-
```bash
|
|
361
|
-
npm login
|
|
362
|
-
npm publish
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
### 5. Users Install & Use
|
|
366
|
-
|
|
367
|
-
```bash
|
|
368
|
-
npm install dirac-http
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
```xml
|
|
372
|
-
<import src="./node_modules/dirac-http/lib/main.di"/>
|
|
373
|
-
<HTTP_GET url="https://example.com"/>
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
## Future Enhancements
|
|
377
|
-
|
|
378
|
-
### 1. Dirac Package Manager
|
|
379
|
-
|
|
380
|
-
```bash
|
|
381
|
-
dirac init # Initialize project
|
|
382
|
-
dirac add http # Add library
|
|
383
|
-
dirac remove http # Remove library
|
|
384
|
-
dirac list # List installed
|
|
385
|
-
dirac search "machine learning" # Search registry
|
|
386
|
-
dirac publish # Publish library
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
### 2. Smart Imports
|
|
390
|
-
|
|
391
|
-
```xml
|
|
392
|
-
<!-- Current -->
|
|
393
|
-
<import src="./node_modules/dirac-http/lib/main.di"/>
|
|
394
|
-
|
|
395
|
-
<!-- Future -->
|
|
396
|
-
<import package="http"/> <!-- From installed packages -->
|
|
397
|
-
<import from="http" names="GET"/> <!-- Named imports -->
|
|
398
|
-
<import src="https://cdn.dirac.org/http/1.0.0/main.di"/> <!-- CDN -->
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
### 3. Type System (Optional)
|
|
402
|
-
|
|
403
|
-
```xml
|
|
404
|
-
<subroutine name="ADD" params="(x: number, y: number) -> number">
|
|
405
|
-
<expr eval="plus">
|
|
406
|
-
<arg><parameters select="@x"/></arg>
|
|
407
|
-
<arg><parameters select="@y"/></arg>
|
|
408
|
-
</expr>
|
|
409
|
-
</subroutine>
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### 4. Testing Framework
|
|
413
|
-
|
|
414
|
-
```xml
|
|
415
|
-
<import src="@dirac/test"/>
|
|
416
|
-
|
|
417
|
-
<test name="ADD works correctly">
|
|
418
|
-
<assert>
|
|
419
|
-
<expr eval="eq">
|
|
420
|
-
<arg><ADD x="1" y="2"/></arg>
|
|
421
|
-
<arg>3</arg>
|
|
422
|
-
</expr>
|
|
423
|
-
</assert>
|
|
424
|
-
</test>
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
## Community Growth Phases
|
|
428
|
-
|
|
429
|
-
### Phase 1: Bootstrap (Month 1-3)
|
|
430
|
-
- ✅ Core interpreter working
|
|
431
|
-
- ✅ Basic examples
|
|
432
|
-
- Create 5-10 core libraries
|
|
433
|
-
- Set up GitHub org
|
|
434
|
-
- Launch Discord
|
|
435
|
-
|
|
436
|
-
### Phase 2: Early Adopters (Month 4-6)
|
|
437
|
-
- npm publishing convention
|
|
438
|
-
- awesome-dirac list
|
|
439
|
-
- Tutorial videos
|
|
440
|
-
- First community libraries
|
|
441
|
-
|
|
442
|
-
### Phase 3: Growth (Month 7-12)
|
|
443
|
-
- 50+ libraries on npm
|
|
444
|
-
- diraclibs.org registry
|
|
445
|
-
- Conference talks
|
|
446
|
-
- Plugin for VS Code
|
|
447
|
-
|
|
448
|
-
### Phase 4: Maturity (Year 2+)
|
|
449
|
-
- 200+ libraries
|
|
450
|
-
- Dirac package manager
|
|
451
|
-
- Corporate adoption
|
|
452
|
-
- Certification program
|
|
453
|
-
|
|
454
|
-
## Getting Started Contributing
|
|
455
|
-
|
|
456
|
-
1. **Pick a domain**: crypto, http, db, ml, etc.
|
|
457
|
-
2. **Check existing**: Search npm for `dirac-*`
|
|
458
|
-
3. **Create library**: Use template
|
|
459
|
-
4. **Test thoroughly**: Write examples
|
|
460
|
-
5. **Document well**: README + examples
|
|
461
|
-
6. **Publish**: npm publish
|
|
462
|
-
7. **Announce**: Discord + GitHub discussions
|
|
463
|
-
8. **Maintain**: Respond to issues
|
|
464
|
-
|
|
465
|
-
The ecosystem grows organically as developers scratch their own itches!
|
package/CONDITIONAL-TAGS.md
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
# Conditional Tags in Dirac
|
|
2
|
-
|
|
3
|
-
Dirac supports two styles of conditional execution:
|
|
4
|
-
|
|
5
|
-
## 1. C-Style `<if>` Tag (Based on C MASK)
|
|
6
|
-
|
|
7
|
-
The `<if>` tag uses child elements for structure, following the C MASK pattern.
|
|
8
|
-
|
|
9
|
-
### Syntax
|
|
10
|
-
|
|
11
|
-
```xml
|
|
12
|
-
<if>
|
|
13
|
-
<cond eval="eq|ne|lt|gt|le|ge">
|
|
14
|
-
<arg>value1</arg>
|
|
15
|
-
<arg>value2</arg>
|
|
16
|
-
</cond>
|
|
17
|
-
<then>
|
|
18
|
-
<!-- executed if condition is true -->
|
|
19
|
-
</then>
|
|
20
|
-
<else>
|
|
21
|
-
<!-- executed if condition is false (optional) -->
|
|
22
|
-
</else>
|
|
23
|
-
</if>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Supported Comparison Types
|
|
27
|
-
|
|
28
|
-
- `eq`, `equal`, `same` - Equality comparison
|
|
29
|
-
- `ne`, `notequal`, `different` - Not equal
|
|
30
|
-
- `lt`, `less` - Less than (numeric)
|
|
31
|
-
- `le`, `lessequal` - Less than or equal (numeric)
|
|
32
|
-
- `gt`, `greater` - Greater than (numeric)
|
|
33
|
-
- `ge`, `greaterequal` - Greater than or equal (numeric)
|
|
34
|
-
|
|
35
|
-
### Alternative Syntax
|
|
36
|
-
|
|
37
|
-
You can use `<do>` instead of `<then>`.
|
|
38
|
-
|
|
39
|
-
You can omit the `<cond>` wrapper and use any element as the predicate:
|
|
40
|
-
|
|
41
|
-
```xml
|
|
42
|
-
<if>
|
|
43
|
-
<variable name="x"/>
|
|
44
|
-
<then>
|
|
45
|
-
<output>x exists and is truthy</output>
|
|
46
|
-
</then>
|
|
47
|
-
</if>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Examples
|
|
51
|
-
|
|
52
|
-
```xml
|
|
53
|
-
<!-- Simple equality -->
|
|
54
|
-
<defvar name="x" value="5"/>
|
|
55
|
-
<if>
|
|
56
|
-
<cond eval="eq">
|
|
57
|
-
<arg><variable name="x"/></arg>
|
|
58
|
-
<arg>5</arg>
|
|
59
|
-
</cond>
|
|
60
|
-
<then>
|
|
61
|
-
<output>x equals 5</output>
|
|
62
|
-
</then>
|
|
63
|
-
<else>
|
|
64
|
-
<output>x does not equal 5</output>
|
|
65
|
-
</else>
|
|
66
|
-
</if>
|
|
67
|
-
|
|
68
|
-
<!-- Greater than -->
|
|
69
|
-
<defvar name="age" value="25"/>
|
|
70
|
-
<if>
|
|
71
|
-
<cond eval="gt">
|
|
72
|
-
<arg><variable name="age"/></arg>
|
|
73
|
-
<arg>18</arg>
|
|
74
|
-
</cond>
|
|
75
|
-
<then>
|
|
76
|
-
<output>Adult</output>
|
|
77
|
-
</then>
|
|
78
|
-
<else>
|
|
79
|
-
<output>Minor</output>
|
|
80
|
-
</else>
|
|
81
|
-
</if>
|
|
82
|
-
|
|
83
|
-
<!-- Simple predicate -->
|
|
84
|
-
<defvar name="name" value="Alice"/>
|
|
85
|
-
<if>
|
|
86
|
-
<variable name="name"/>
|
|
87
|
-
<then>
|
|
88
|
-
<output>Name is: <variable name="name"/></output>
|
|
89
|
-
</then>
|
|
90
|
-
</if>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## 2. Attribute-Based `<test-if>` Tag (Original Dirac Style)
|
|
94
|
-
|
|
95
|
-
The `<test-if>` tag uses attributes for conditions, providing a more compact syntax.
|
|
96
|
-
|
|
97
|
-
### Syntax
|
|
98
|
-
|
|
99
|
-
```xml
|
|
100
|
-
<test-if test="$variable" [eq|ne|lt|gt|le|ge]="value">
|
|
101
|
-
<!-- executed if condition is true -->
|
|
102
|
-
</test-if>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Supported Attributes
|
|
106
|
-
|
|
107
|
-
- `test` (required) - The value or variable to test (use `$` prefix for variables)
|
|
108
|
-
- `eq` - Equals comparison
|
|
109
|
-
- `ne` - Not equals comparison
|
|
110
|
-
- `lt` - Less than (numeric)
|
|
111
|
-
- `gt` - Greater than (numeric)
|
|
112
|
-
- `le` - Less than or equal (numeric)
|
|
113
|
-
- `ge` - Greater than or equal (numeric)
|
|
114
|
-
|
|
115
|
-
If no comparison attribute is provided, the test value is evaluated as a boolean (non-empty = true).
|
|
116
|
-
|
|
117
|
-
### Examples
|
|
118
|
-
|
|
119
|
-
```xml
|
|
120
|
-
<!-- Simple boolean test -->
|
|
121
|
-
<defvar name="x" value="5"/>
|
|
122
|
-
<test-if test="$x">
|
|
123
|
-
<output>x is truthy</output>
|
|
124
|
-
</test-if>
|
|
125
|
-
|
|
126
|
-
<!-- Equality test -->
|
|
127
|
-
<defvar name="status" value="active"/>
|
|
128
|
-
<test-if test="$status" eq="active">
|
|
129
|
-
<output>Status is active</output>
|
|
130
|
-
</test-if>
|
|
131
|
-
|
|
132
|
-
<!-- Greater than test -->
|
|
133
|
-
<defvar name="age" value="25"/>
|
|
134
|
-
<test-if test="$age" gt="18">
|
|
135
|
-
<output>Age is greater than 18</output>
|
|
136
|
-
</test-if>
|
|
137
|
-
|
|
138
|
-
<!-- Less than or equal -->
|
|
139
|
-
<defvar name="price" value="50"/>
|
|
140
|
-
<test-if test="$price" le="50">
|
|
141
|
-
<output>Price is affordable</output>
|
|
142
|
-
</test-if>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Choosing Between `<if>` and `<test-if>`
|
|
146
|
-
|
|
147
|
-
- Use **`<if>`** when:
|
|
148
|
-
- You need an else clause
|
|
149
|
-
- You're porting code from C MASK
|
|
150
|
-
- You prefer explicit structure
|
|
151
|
-
- You need complex predicates
|
|
152
|
-
|
|
153
|
-
- Use **`<test-if>`** when:
|
|
154
|
-
- You only need a then clause (no else)
|
|
155
|
-
- You want compact, attribute-based syntax
|
|
156
|
-
- You're doing simple comparisons
|
|
157
|
-
- You prefer the original Dirac style
|
|
158
|
-
|
|
159
|
-
## Truthiness Evaluation
|
|
160
|
-
|
|
161
|
-
Both tags evaluate values as follows:
|
|
162
|
-
|
|
163
|
-
- **False**: Empty string, "0", "false"
|
|
164
|
-
- **True**: "1", "true", any non-empty string
|
|
165
|
-
- For numeric comparisons, values are parsed as floats
|
|
166
|
-
|
|
167
|
-
## Notes
|
|
168
|
-
|
|
169
|
-
- Condition evaluation does not produce output (intermediate values are captured and removed)
|
|
170
|
-
- Arguments in `<cond>` are evaluated and their outputs captured
|
|
171
|
-
- Variable substitution in `<test-if>` uses `$varname` or `${varname}` syntax
|
|
172
|
-
- Both tags support nested content including `<defvar>`, `<output>`, and other tags
|