@askrjs/cli 0.0.2 → 0.0.3
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/README.md +9 -7
- package/dist/add.js +554 -1
- package/dist/add.js.map +1 -0
- package/dist/cli.js +43 -14
- package/dist/cli.js.map +1 -1
- package/dist/discovery-Difb7Y4G.js +325 -0
- package/dist/discovery-Difb7Y4G.js.map +1 -0
- package/dist/generate.js +396 -0
- package/dist/generate.js.map +1 -0
- package/dist/openapi.js +5 -4
- package/dist/openapi.js.map +1 -1
- package/dist/planner-VAj7qlxr.js +287 -0
- package/dist/planner-VAj7qlxr.js.map +1 -0
- package/dist/range-YUs9eimn.js +127 -0
- package/dist/range-YUs9eimn.js.map +1 -0
- package/dist/registry-CyrRHRG5.js +211 -0
- package/dist/registry-CyrRHRG5.js.map +1 -0
- package/dist/skills/askr-dashboard-charts/SKILL.md +61 -44
- package/dist/skills/askr-dashboard-charts/agents/openai.yaml +2 -2
- package/dist/specification-DXnDOC-0.js +51 -0
- package/dist/specification-DXnDOC-0.js.map +1 -0
- package/dist/templates/full-stack/AGENTS.md +0 -1
- package/dist/templates/full-stack/README.md +0 -1
- package/dist/templates/full-stack/index.html +0 -1
- package/dist/templates/full-stack/package.json +4 -2
- package/dist/templates/full-stack/server.ts +5 -9
- package/dist/templates/full-stack/src/action-authorizations.ts +2 -2
- package/dist/templates/full-stack/src/actions/create-message.ts +5 -5
- package/dist/templates/full-stack/src/i18n.ts +4 -4
- package/dist/templates/full-stack/src/main.tsx +4 -5
- package/dist/templates/full-stack/src/pages/home.tsx +5 -5
- package/dist/templates/full-stack/src/pages/layout.tsx +15 -5
- package/dist/templates/full-stack/src/pages/not-found.tsx +5 -2
- package/dist/templates/full-stack/src/routes.tsx +11 -12
- package/dist/templates/full-stack/src/schemas.ts +1 -2
- package/dist/templates/full-stack/src/server/action-registry.ts +6 -10
- package/dist/templates/full-stack/src/server/actions/create-message.ts +4 -4
- package/dist/templates/full-stack/src/server/app.ts +67 -57
- package/dist/templates/full-stack/src/server/dependencies.ts +10 -10
- package/dist/templates/full-stack/src/server/entry-server.ts +3 -3
- package/dist/templates/full-stack/src/telemetry.ts +1 -2
- package/dist/templates/full-stack/src/vite-server.d.ts +2 -3
- package/dist/templates/full-stack/tests/actions/create-message.test.ts +7 -8
- package/dist/templates/full-stack/tsconfig.json +0 -1
- package/dist/templates/full-stack/vite.config.ts +5 -6
- package/dist/templates/spa/AGENTS.md +1 -1
- package/dist/templates/spa/package.json +1 -1
- package/dist/templates/spa/src/adapters/operations-client.ts +7 -2
- package/dist/templates/spa/src/pages/app/admin-home.tsx +21 -3
- package/dist/templates/spa/src/styles.css +1 -1
- package/dist/templates/ssg/tests/ssg-config.test.ts +3 -3
- package/dist/templates/ssr/server.ts +4 -10
- package/dist/templates/ssr/src/entry-server.tsx +6 -4
- package/dist/update.js +284 -2
- package/dist/update.js.map +1 -0
- package/dist/writer-D8qe_7ud.js +228 -0
- package/dist/writer-D8qe_7ud.js.map +1 -0
- package/package.json +11 -15
- package/skills/askr-dashboard-charts/SKILL.md +61 -44
- package/skills/askr-dashboard-charts/agents/openai.yaml +2 -2
- package/templates/full-stack/AGENTS.md +0 -1
- package/templates/full-stack/README.md +0 -1
- package/templates/full-stack/index.html +0 -1
- package/templates/full-stack/package.json +4 -2
- package/templates/full-stack/server.ts +5 -9
- package/templates/full-stack/src/action-authorizations.ts +2 -2
- package/templates/full-stack/src/actions/create-message.ts +5 -5
- package/templates/full-stack/src/i18n.ts +4 -4
- package/templates/full-stack/src/main.tsx +4 -5
- package/templates/full-stack/src/pages/home.tsx +5 -5
- package/templates/full-stack/src/pages/layout.tsx +15 -5
- package/templates/full-stack/src/pages/not-found.tsx +5 -2
- package/templates/full-stack/src/routes.tsx +11 -12
- package/templates/full-stack/src/schemas.ts +1 -2
- package/templates/full-stack/src/server/action-registry.ts +6 -10
- package/templates/full-stack/src/server/actions/create-message.ts +4 -4
- package/templates/full-stack/src/server/app.ts +67 -57
- package/templates/full-stack/src/server/dependencies.ts +10 -10
- package/templates/full-stack/src/server/entry-server.ts +3 -3
- package/templates/full-stack/src/telemetry.ts +1 -2
- package/templates/full-stack/src/vite-server.d.ts +2 -3
- package/templates/full-stack/tests/actions/create-message.test.ts +7 -8
- package/templates/full-stack/tsconfig.json +0 -1
- package/templates/full-stack/vite.config.ts +5 -6
- package/templates/spa/AGENTS.md +1 -1
- package/templates/spa/package.json +1 -1
- package/templates/spa/src/adapters/operations-client.ts +7 -2
- package/templates/spa/src/pages/app/admin-home.tsx +21 -3
- package/templates/spa/src/styles.css +1 -1
- package/templates/ssg/tests/ssg-config.test.ts +3 -3
- package/templates/ssr/server.ts +4 -10
- package/templates/ssr/src/entry-server.tsx +6 -4
- package/dist/add-DqhqRzBQ.js +0 -555
- package/dist/add-DqhqRzBQ.js.map +0 -1
- package/dist/update-DyW1na5V.js +0 -1140
- package/dist/update-DyW1na5V.js.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { describe, expect, it } from
|
|
2
|
-
import { createMessageAction } from
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createMessageAction } from "../../src/actions/create-message";
|
|
3
3
|
|
|
4
|
-
describe(
|
|
5
|
-
it(
|
|
6
|
-
expect(createMessageAction.input.safeParse({ value:
|
|
4
|
+
describe("create message action", () => {
|
|
5
|
+
it("should reject an empty message given declared input validation", () => {
|
|
6
|
+
expect(createMessageAction.input.safeParse({ value: "" }).success).toBe(false);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
it(
|
|
10
|
-
expect(createMessageAction.input.safeParse({ value:
|
|
9
|
+
it("should accept a message given valid input", () => {
|
|
10
|
+
expect(createMessageAction.input.safeParse({ value: "hello" }).success).toBe(true);
|
|
11
11
|
});
|
|
12
12
|
});
|
|
13
|
-
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import { askr } from
|
|
3
|
-
import { askrServer } from
|
|
1
|
+
import { defineConfig } from "vite-plus";
|
|
2
|
+
import { askr } from "@askrjs/vite";
|
|
3
|
+
import { askrServer } from "@askrjs/vite/server";
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
plugins: [askr(), askrServer({ entry:
|
|
7
|
-
lint: { ignorePatterns: [
|
|
6
|
+
plugins: [askr(), askrServer({ entry: "./src/server/entry-server.ts" })],
|
|
7
|
+
lint: { ignorePatterns: ["dist/**", "node_modules/**", "coverage/**"] },
|
|
8
8
|
server: { port: 5173, open: true },
|
|
9
9
|
build: { manifest: true, sourcemap: true },
|
|
10
10
|
});
|
|
11
|
-
|
package/templates/spa/AGENTS.md
CHANGED
|
@@ -23,7 +23,7 @@ npm run fmt # Prettier
|
|
|
23
23
|
- **Data:** Route/container components own resources; `src/features` owns product workflows; `src/adapters` owns API clients, transports, abort handling, and generated clients.
|
|
24
24
|
- **Consistency:** Event-sourced screens should expose pending writes, projection lag, stale data, retries, and manual refresh instead of hiding everything behind one loading state.
|
|
25
25
|
- **Styling:** Keep `src/styles.css` thin. Customize theme values in `src/styles/tokens.css`, global defaults in `src/styles/theme.css`, shell structure in `src/styles/layout.css`, and component classes in `src/styles/components.css`.
|
|
26
|
-
- **Charts:**
|
|
26
|
+
- **Charts:** Create typed plot namespaces from `@askrjs/charts` at module scope and compose marks inside `Plot.Root`; chart CSS is loaded from `@askrjs/charts/styles`.
|
|
27
27
|
- **Vite plugin:** `askr()` from `@askrjs/vite` handles JSX transform. Do not add manual esbuild JSX config.
|
|
28
28
|
|
|
29
29
|
## File Structure
|
|
@@ -8,13 +8,18 @@ export type OperationRun = {
|
|
|
8
8
|
updatedAt: string;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
export type OperationsChartRow = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
11
16
|
export type OperationsSnapshot = {
|
|
12
17
|
version: number;
|
|
13
18
|
consistency: 'fresh' | 'pending-write' | 'stale';
|
|
14
19
|
lastEventId: string;
|
|
15
20
|
metrics: Array<{ label: string; value: string; trend: string }>;
|
|
16
|
-
throughput:
|
|
17
|
-
lag:
|
|
21
|
+
throughput: OperationsChartRow[];
|
|
22
|
+
lag: OperationsChartRow[];
|
|
18
23
|
runs: OperationRun[];
|
|
19
24
|
};
|
|
20
25
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resource } from '@askrjs/askr/resources';
|
|
2
|
-
import {
|
|
2
|
+
import { createPlot } from '@askrjs/charts';
|
|
3
3
|
import { AlertCircleIcon, RefreshCwIcon } from '@askrjs/lucide';
|
|
4
4
|
import { Button } from '@askrjs/themes/components';
|
|
5
5
|
import {
|
|
@@ -16,9 +16,12 @@ import { Block, Inline, Section, Stack } from '@askrjs/themes/components';
|
|
|
16
16
|
import { EmptyState } from '@askrjs/themes/components';
|
|
17
17
|
import MetricCard from '../../components/shared/metric-card';
|
|
18
18
|
import StatusBadge from '../../components/shared/status-badge';
|
|
19
|
+
import type { OperationsChartRow } from '../../adapters/operations-client';
|
|
19
20
|
import { loadOperations } from '../../features/operations/operations.query';
|
|
20
21
|
import { formatRelativeTime } from '../../shared/format';
|
|
21
22
|
|
|
23
|
+
const OperationsPlot = createPlot<OperationsChartRow>();
|
|
24
|
+
|
|
22
25
|
export default function AdminHomePage() {
|
|
23
26
|
const operations = resource(({ signal }) => loadOperations({ signal }), []);
|
|
24
27
|
const snapshot = operations.value;
|
|
@@ -84,7 +87,14 @@ export default function AdminHomePage() {
|
|
|
84
87
|
</CardDescription>
|
|
85
88
|
</CardHeader>
|
|
86
89
|
<CardContent>
|
|
87
|
-
<
|
|
90
|
+
<OperationsPlot.Root
|
|
91
|
+
data={snapshot.throughput}
|
|
92
|
+
rowKey="label"
|
|
93
|
+
label="Run throughput"
|
|
94
|
+
description="Accepted commands by work type."
|
|
95
|
+
>
|
|
96
|
+
<OperationsPlot.Bar x="label" y="value" />
|
|
97
|
+
</OperationsPlot.Root>
|
|
88
98
|
</CardContent>
|
|
89
99
|
</Card>
|
|
90
100
|
<Card>
|
|
@@ -95,7 +105,15 @@ export default function AdminHomePage() {
|
|
|
95
105
|
</CardDescription>
|
|
96
106
|
</CardHeader>
|
|
97
107
|
<CardContent>
|
|
98
|
-
<
|
|
108
|
+
<OperationsPlot.Root
|
|
109
|
+
data={snapshot.lag}
|
|
110
|
+
rowKey="label"
|
|
111
|
+
label="Projection lag"
|
|
112
|
+
description="Projection lag over the last hour."
|
|
113
|
+
>
|
|
114
|
+
<OperationsPlot.Line x="label" y="value" />
|
|
115
|
+
<OperationsPlot.Point x="label" y="value" />
|
|
116
|
+
</OperationsPlot.Root>
|
|
99
117
|
</CardContent>
|
|
100
118
|
</Card>
|
|
101
119
|
</Block>
|
|
@@ -3,9 +3,9 @@ import { staticConfig } from '../ssg.config';
|
|
|
3
3
|
|
|
4
4
|
describe('SSG config', () => {
|
|
5
5
|
it('keeps the sample route tree explicit', () => {
|
|
6
|
-
expect(
|
|
7
|
-
|
|
8
|
-
);
|
|
6
|
+
expect(
|
|
7
|
+
staticConfig.registry.manifest.records.map((route) => route.path).sort()
|
|
8
|
+
).toEqual(['/', '/content', '/preview', '/workflow'].sort());
|
|
9
9
|
expect(staticConfig.registry.routes).toHaveLength(4);
|
|
10
10
|
});
|
|
11
11
|
});
|
package/templates/ssr/server.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serve } from '@askrjs/node';
|
|
2
2
|
import app from 'virtual:askr-server';
|
|
3
3
|
|
|
4
4
|
const port = Number(process.env.PORT ?? 3000);
|
|
5
|
-
const
|
|
5
|
+
const running = await serve(app, {
|
|
6
6
|
host: process.env.HOST ?? '127.0.0.1',
|
|
7
7
|
port,
|
|
8
|
+
assets: { root: new URL('./dist', import.meta.url).pathname },
|
|
8
9
|
});
|
|
9
|
-
|
|
10
|
-
const boundPort = typeof address === 'object' && address ? address.port : port;
|
|
11
|
-
|
|
12
|
-
console.log(`Server started at http://127.0.0.1:${boundPort}`);
|
|
13
|
-
|
|
14
|
-
const shutdown = () => server.close();
|
|
15
|
-
process.once('SIGINT', shutdown);
|
|
16
|
-
process.once('SIGTERM', shutdown);
|
|
10
|
+
console.log(`Server started at ${running.url}`);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createAskrPageHandler } from '@askrjs/server/askr';
|
|
1
|
+
import { createAskrApp } from '@askrjs/server/askr';
|
|
3
2
|
import { pageRegistry } from './routes';
|
|
4
3
|
|
|
5
|
-
const app =
|
|
6
|
-
|
|
4
|
+
const app = createAskrApp({
|
|
5
|
+
name: '{{appName}}',
|
|
6
|
+
version: '0.1.0',
|
|
7
|
+
dependencies: undefined,
|
|
8
|
+
pages: pageRegistry,
|
|
7
9
|
});
|
|
8
10
|
|
|
9
11
|
export { app };
|