Skip to content

Commit d2cf985

Browse files
Merge pull request #2 from tensorix-labs/feat/app-http-server
Feat/app http server
2 parents 74822c7 + 2f72fee commit d2cf985

File tree

103 files changed

+12167
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+12167
-184
lines changed

.changeset/short-hoops-peel.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@t-req/core": minor
3+
"@t-req/app": minor
4+
---
5+
6+
Add JSON/JSONC-first Config v2 with deterministic layering (profiles + overrides), safe {env:}/{file:} substitutions, and command-resolver support. Improve cookie persistence safety with serialized writes and add coverage for critical config paths.

.github/workflows/release-app.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release App
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to publish (e.g., 0.1.0)"
8+
required: true
9+
type: string
10+
dry-run:
11+
description: "Dry run (don't actually publish)"
12+
required: false
13+
type: boolean
14+
default: false
15+
16+
jobs:
17+
release:
18+
name: Build and Publish App
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
id-token: write
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Bun
29+
uses: oven-sh/setup-bun@v2
30+
with:
31+
bun-version: latest
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: "20"
37+
registry-url: "https://registry.npmjs.org"
38+
39+
- name: Install dependencies
40+
run: bun install
41+
working-directory: packages/app
42+
43+
- name: Update version
44+
run: |
45+
cd packages/app
46+
bun -e "
47+
const pkg = await Bun.file('package.json').json();
48+
pkg.version = '${{ inputs.version }}';
49+
pkg.optionalDependencies = {
50+
'@t-req/app-darwin-arm64': '${{ inputs.version }}',
51+
'@t-req/app-darwin-x64': '${{ inputs.version }}',
52+
'@t-req/app-linux-arm64': '${{ inputs.version }}',
53+
'@t-req/app-linux-x64': '${{ inputs.version }}',
54+
'@t-req/app-windows-x64': '${{ inputs.version }}',
55+
};
56+
await Bun.write('package.json', JSON.stringify(pkg, null, 2));
57+
"
58+
59+
- name: Build and Publish
60+
run: |
61+
cd packages/app
62+
if [ "${{ inputs.dry-run }}" = "true" ]; then
63+
bun run script/publish.ts --dry-run
64+
else
65+
bun run script/publish.ts
66+
fi
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69+
70+
- name: Create GitHub Release
71+
if: ${{ !inputs.dry-run }}
72+
run: |
73+
gh release create app-v${{ inputs.version }} \
74+
--title "App v${{ inputs.version }}" \
75+
--generate-notes
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ HTTP request parsing, execution, and testing. Define requests in `.http` files,
1010
| Package | Description |
1111
|---------|-------------|
1212
| [@t-req/core](./packages/core) | Core HTTP request parsing and execution library |
13+
| [@t-req/app](./packages/app) | CLI for scaffolding, executing, and serving t-req projects |
1314
| [@t-req/ui](./packages/ui) | Shared UI components and Tailwind CSS configuration |
1415

1516
## Documentation
@@ -62,6 +63,7 @@ t-req/
6263
├── examples/ # Usage examples
6364
├── packages/
6465
│ ├── core/ # @t-req/core - HTTP parsing & execution
66+
│ ├── app/ # @t-req/app - CLI tool
6567
│ └── ui/ # @t-req/ui - UI components & theming
6668
├── .changeset/ # Changesets for versioning
6769
└── ...

apps/webdocs/src/content/docs/concepts/variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ X-Request-ID: {{$uuid()}}
8989
X-Timestamp: {{$timestamp()}}
9090
9191
{
92-
"random_value": {{$random(1, 100)}}
92+
"random_value": {{$random([1, 100])}}
9393
}
9494
```
9595

apps/webdocs/src/content/docs/guides/authentication.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ const client = createClient({
6868

6969
```http
7070
GET https://api.example.com/admin
71-
Authorization: Basic {{$basicAuth({{username}}, {{password}})}}
71+
Authorization: Basic {{$basicAuth(["{{username}}", "{{password}}"])}}
7272
```
7373

74-
> **Note:** Variables inside resolver calls are interpolated first. The expression
75-
> `{{$basicAuth({{username}}, {{password}})}}` first becomes `{{$basicAuth(admin, secret)}}`,
74+
> **Note:** Variables inside resolver calls are interpolated first. With JSON-args, the expression
75+
> `{{$basicAuth(["{{username}}", "{{password}}"])}}` becomes `{{$basicAuth(["admin", "secret"])}}`,
7676
> then the resolver is called with literal strings `"admin"` and `"secret"`.
7777
7878
Or pre-encode in the variable:

apps/webdocs/src/content/docs/reference/interpolation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ interpolate('User: {{user.name}}', {
115115
```
116116
{{$resolverName()}}
117117
{{$resolverName(arg1)}}
118-
{{$resolverName(arg1, arg2)}}
118+
{{$resolverName(["arg1","arg2"])}}
119119
```
120120

121121
```typescript
@@ -129,7 +129,8 @@ const interp = createInterpolator({
129129
},
130130
});
131131

132-
await interp.interpolate('Value: {{$random(1, 10)}}', {});
132+
// Prefer JSON-array args for unambiguous parsing:
133+
await interp.interpolate('Value: {{$random([1, 10])}}', {});
133134
// "Value: 7" (random between 1-10)
134135
```
135136

0 commit comments

Comments
 (0)