@hasna/prompts 0.1.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,125 @@
1
+ export interface Prompt {
2
+ id: string;
3
+ name: string;
4
+ slug: string;
5
+ title: string;
6
+ body: string;
7
+ description: string | null;
8
+ collection: string;
9
+ tags: string[];
10
+ variables: TemplateVariable[];
11
+ is_template: boolean;
12
+ source: PromptSource;
13
+ version: number;
14
+ use_count: number;
15
+ last_used_at: string | null;
16
+ created_at: string;
17
+ updated_at: string;
18
+ }
19
+ export interface TemplateVariable {
20
+ name: string;
21
+ description?: string;
22
+ default?: string;
23
+ required: boolean;
24
+ }
25
+ export interface PromptVersion {
26
+ id: string;
27
+ prompt_id: string;
28
+ body: string;
29
+ version: number;
30
+ changed_by: string | null;
31
+ created_at: string;
32
+ }
33
+ export interface Collection {
34
+ id: string;
35
+ name: string;
36
+ description: string | null;
37
+ prompt_count: number;
38
+ created_at: string;
39
+ }
40
+ export interface Agent {
41
+ id: string;
42
+ name: string;
43
+ description: string | null;
44
+ created_at: string;
45
+ last_seen_at: string;
46
+ }
47
+ export type PromptSource = "manual" | "ai-session" | "imported";
48
+ export interface CreatePromptInput {
49
+ name?: string;
50
+ slug?: string;
51
+ title: string;
52
+ body: string;
53
+ description?: string;
54
+ collection?: string;
55
+ tags?: string[];
56
+ source?: PromptSource;
57
+ changed_by?: string;
58
+ }
59
+ export interface UpdatePromptInput {
60
+ title?: string;
61
+ body?: string;
62
+ description?: string;
63
+ collection?: string;
64
+ tags?: string[];
65
+ changed_by?: string;
66
+ }
67
+ export interface ListPromptsFilter {
68
+ collection?: string;
69
+ tags?: string[];
70
+ is_template?: boolean;
71
+ source?: PromptSource;
72
+ q?: string;
73
+ limit?: number;
74
+ offset?: number;
75
+ }
76
+ export interface SearchResult {
77
+ prompt: Prompt;
78
+ score: number;
79
+ snippet?: string;
80
+ }
81
+ export interface RenderResult {
82
+ rendered: string;
83
+ missing_vars: string[];
84
+ used_defaults: string[];
85
+ }
86
+ export interface PromptStats {
87
+ total_prompts: number;
88
+ total_templates: number;
89
+ total_collections: number;
90
+ most_used: Array<{
91
+ id: string;
92
+ name: string;
93
+ slug: string;
94
+ title: string;
95
+ use_count: number;
96
+ }>;
97
+ recently_used: Array<{
98
+ id: string;
99
+ name: string;
100
+ slug: string;
101
+ title: string;
102
+ last_used_at: string;
103
+ }>;
104
+ by_collection: Array<{
105
+ collection: string;
106
+ count: number;
107
+ }>;
108
+ by_source: Array<{
109
+ source: string;
110
+ count: number;
111
+ }>;
112
+ }
113
+ export declare class PromptNotFoundError extends Error {
114
+ constructor(id: string);
115
+ }
116
+ export declare class VersionConflictError extends Error {
117
+ constructor(id: string);
118
+ }
119
+ export declare class DuplicateSlugError extends Error {
120
+ constructor(slug: string);
121
+ }
122
+ export declare class TemplateRenderError extends Error {
123
+ constructor(message: string);
124
+ }
125
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,SAAS,EAAE,gBAAgB,EAAE,CAAA;IAC7B,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AA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,CAAA;KAAE,CAAC,CAAA;IACrG,aAAa,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC3D,SAAS,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACpD;AAED,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,EAAE,EAAE,MAAM;CAIvB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,EAAE,EAAE,MAAM;CAIvB;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@hasna/prompts",
3
+ "version": "0.1.0",
4
+ "description": "Reusable prompt library for AI agents — CLI + MCP server + REST API + web dashboard",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "open-prompts": "dist/cli/index.js",
10
+ "open-prompts-mcp": "dist/mcp/index.js",
11
+ "open-prompts-serve": "dist/server/index.js"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "dashboard/dist",
22
+ "LICENSE",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "cd dashboard && bun run build && cd .. && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk && bun build src/server/index.ts --outdir dist/server --target bun && bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --outDir dist",
27
+ "build:cli": "bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk",
28
+ "build:mcp": "bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk",
29
+ "build:server": "bun build src/server/index.ts --outdir dist/server --target bun",
30
+ "build:lib": "bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --outDir dist",
31
+ "build:dashboard": "cd dashboard && bun run build",
32
+ "typecheck": "tsc --noEmit",
33
+ "test": "bun test",
34
+ "dev:cli": "bun run src/cli/index.tsx",
35
+ "dev:mcp": "bun run src/mcp/index.ts",
36
+ "dev:serve": "bun run src/server/index.ts"
37
+ },
38
+ "keywords": [
39
+ "prompts",
40
+ "templates",
41
+ "mcp",
42
+ "ai",
43
+ "coding-agent",
44
+ "claude",
45
+ "codex",
46
+ "gemini",
47
+ "tui",
48
+ "cli",
49
+ "dashboard"
50
+ ],
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/hasna/open-prompts.git"
57
+ },
58
+ "homepage": "https://github.com/hasna/open-prompts",
59
+ "bugs": {
60
+ "url": "https://github.com/hasna/open-prompts/issues"
61
+ },
62
+ "engines": {
63
+ "bun": ">=1.0.0"
64
+ },
65
+ "author": "Andrei Hasna <andrei@hasna.com>",
66
+ "license": "Apache-2.0",
67
+ "dependencies": {
68
+ "@modelcontextprotocol/sdk": "^1.12.1",
69
+ "chalk": "^5.4.1",
70
+ "commander": "^13.1.0",
71
+ "ink": "^5.2.0",
72
+ "react": "^18.3.1",
73
+ "zod": "^3.24.2"
74
+ },
75
+ "devDependencies": {
76
+ "@types/bun": "^1.2.4",
77
+ "@types/react": "^18.3.18",
78
+ "typescript": "^5.7.3"
79
+ }
80
+ }