@crasi/bisque-cli 0.0.0-stage → 0.3.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.
@@ -0,0 +1,74 @@
1
+ import { type ContractManifest } from "@crasi/bisque-contract";
2
+ /**
3
+ * Fixture checks a host exports next to its contract (`export const fixtures`
4
+ * in bisque.config.ts). A derived resource must reproduce the number the
5
+ * host's own screen shows for a fixture, or users will see two different
6
+ * "sales" (issue I3, H7).
7
+ */
8
+ export type DerivedFixture = {
9
+ label: string;
10
+ resource: string;
11
+ field: string;
12
+ rows: () => Record<string, unknown>[] | Promise<Record<string, unknown>[]>;
13
+ where?: (row: Record<string, unknown>) => boolean;
14
+ /** What the host's own screen shows for the same fixture. */
15
+ expected: number | (() => number | Promise<number>);
16
+ };
17
+ export type BisqueFixtures = {
18
+ derived?: DerivedFixture[];
19
+ };
20
+ export type ReviewItem = {
21
+ id: string;
22
+ section: "EXPOSED" | "EXCLUDED" | "SHARED WITH MODEL" | "INTENTS" | "AUTOMATIONS" | "DERIVED" | "UNREVIEWED";
23
+ text: string;
24
+ /** ok: nothing to do. risky: needs the signer's acknowledgement. blocking: must be fixed; cannot be signed away. */
25
+ level: "ok" | "info" | "risky" | "blocking";
26
+ note?: string;
27
+ };
28
+ export type ReviewRecord = {
29
+ app: string;
30
+ version: string;
31
+ contractHash: string;
32
+ signer: string;
33
+ signedAt: string;
34
+ /** Risky item ids the signer acknowledged. */
35
+ acknowledged: string[];
36
+ };
37
+ export type Introspected = {
38
+ excluded: {
39
+ table: string;
40
+ reason: string;
41
+ }[];
42
+ excludedFields: {
43
+ table: string;
44
+ field: string;
45
+ reason: string;
46
+ }[];
47
+ };
48
+ export declare function runDerivedChecks(fx: BisqueFixtures | undefined): Promise<{
49
+ label: string;
50
+ resource: string;
51
+ field: string;
52
+ actual: number;
53
+ expected: number;
54
+ ok: boolean;
55
+ }[]>;
56
+ export declare function contractQuality(m: ContractManifest): {
57
+ score: number;
58
+ describedShare: number;
59
+ glossaryTerms: number;
60
+ derived: number;
61
+ };
62
+ /**
63
+ * The review sheet (§7.7). Everything a human must look at on one page,
64
+ * because the contract is the security boundary and an agent may have
65
+ * written it.
66
+ */
67
+ export declare function buildReview(m: ContractManifest, opts?: {
68
+ fixtures?: BisqueFixtures;
69
+ introspected?: Introspected;
70
+ }): Promise<ReviewItem[]>;
71
+ export declare function formatReview(m: ContractManifest, items: ReviewItem[], signed: ReviewRecord | null, hash: string): string;
72
+ export declare function signReview(m: ContractManifest, hash: string, items: ReviewItem[], signer: string, now?: Date): ReviewRecord;
73
+ /** Risky items present now that the signature did not cover. */
74
+ export declare function unacknowledged(items: ReviewItem[], r: ReviewRecord | null): ReviewItem[];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A small parser for Supabase migrations (`supabase/migrations/*.sql`), enough
3
+ * to draft a contract: tables, columns, types, nullability, foreign keys,
4
+ * `check (x in (...))` enums and `comment on` descriptions. It replays the
5
+ * migrations in order, so later `alter table` statements win. It is not a
6
+ * SQL parser; anything it does not recognise is skipped, never guessed.
7
+ */
8
+ export type SqlColumn = {
9
+ name: string;
10
+ sqlType: string;
11
+ type: "string" | "number" | "boolean" | "date" | "datetime" | "json" | "array";
12
+ nullable: boolean;
13
+ primaryKey: boolean;
14
+ references?: string;
15
+ enum?: string[];
16
+ comment?: string;
17
+ hasDefault: boolean;
18
+ };
19
+ export type SqlTable = {
20
+ name: string;
21
+ schema: string;
22
+ columns: SqlColumn[];
23
+ comment?: string;
24
+ };
25
+ export declare function mapType(sqlType: string): SqlColumn["type"];
26
+ /** Splits on semicolons outside quotes, parentheses and dollar-quoted bodies. */
27
+ export declare function statements(sql: string): string[];
28
+ export declare function parseMigrations(files: {
29
+ name: string;
30
+ sql: string;
31
+ }[]): SqlTable[];
@@ -0,0 +1,10 @@
1
+ export declare function configStub(app: string, importFrom: string): string;
2
+ export declare function tokenRoute(supabase: boolean): string;
3
+ export declare function cspSnippet(_app: string): string;
4
+ /**
5
+ * The artifact store in the host's own database (decision D1). One row per
6
+ * revision; the head is the current one. RLS: users see their own artifacts
7
+ * and the workspace's; only owners change an artifact; others may only hide
8
+ * a workspace artifact for themselves.
9
+ */
10
+ export declare function artifactsMigration(): string;
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@crasi/bisque-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.0",
4
+ "description": "bisque init, introspect, review, check, push",
5
+ "license": "MIT",
6
+ "author": "Crasi",
7
+ "homepage": "https://github.com/gogeorge/bisque#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/gogeorge/bisque.git",
11
+ "directory": "packages/cli"
12
+ },
13
+ "bugs": "https://github.com/gogeorge/bisque/issues",
14
+ "keywords": [
15
+ "bisque",
16
+ "generative-ui",
17
+ "ai",
18
+ "llm",
19
+ "cli",
20
+ "codegen"
21
+ ],
22
+ "type": "module",
23
+ "engines": {
24
+ "node": ">=20"
25
+ },
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/types/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./review": {
32
+ "types": "./dist/types/review.d.ts",
33
+ "default": "./dist/review.js"
34
+ }
35
+ },
36
+ "bin": {
37
+ "bisque": "./dist/bin.js"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "README.md",
42
+ "LICENSE"
43
+ ],
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "dependencies": {
48
+ "jiti": "^2.7.0",
49
+ "@crasi/bisque-spec": "0.3.0",
50
+ "@crasi/bisque-core": "0.3.0",
51
+ "@crasi/bisque-contract": "0.3.0"
52
+ },
53
+ "devDependencies": {
54
+ "@crasi/bisque-conductor": "0.3.0"
55
+ },
56
+ "scripts": {
57
+ "typecheck": "tsc -p ."
58
+ }
6
59
  }