prelude-context 1.0.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.
Files changed (94) hide show
  1. package/README.md +354 -0
  2. package/dist/bin/prelude.d.ts +3 -0
  3. package/dist/bin/prelude.d.ts.map +1 -0
  4. package/dist/bin/prelude.js +35 -0
  5. package/dist/bin/prelude.js.map +1 -0
  6. package/dist/src/commands/decision.d.ts +3 -0
  7. package/dist/src/commands/decision.d.ts.map +1 -0
  8. package/dist/src/commands/decision.js +74 -0
  9. package/dist/src/commands/decision.js.map +1 -0
  10. package/dist/src/commands/export.d.ts +3 -0
  11. package/dist/src/commands/export.d.ts.map +1 -0
  12. package/dist/src/commands/export.js +132 -0
  13. package/dist/src/commands/export.js.map +1 -0
  14. package/dist/src/commands/init.d.ts +3 -0
  15. package/dist/src/commands/init.d.ts.map +1 -0
  16. package/dist/src/commands/init.js +80 -0
  17. package/dist/src/commands/init.js.map +1 -0
  18. package/dist/src/commands/share.d.ts +3 -0
  19. package/dist/src/commands/share.d.ts.map +1 -0
  20. package/dist/src/commands/share.js +133 -0
  21. package/dist/src/commands/share.js.map +1 -0
  22. package/dist/src/commands/watch.d.ts +3 -0
  23. package/dist/src/commands/watch.d.ts.map +1 -0
  24. package/dist/src/commands/watch.js +58 -0
  25. package/dist/src/commands/watch.js.map +1 -0
  26. package/dist/src/constants.d.ts +16 -0
  27. package/dist/src/constants.d.ts.map +1 -0
  28. package/dist/src/constants.js +49 -0
  29. package/dist/src/constants.js.map +1 -0
  30. package/dist/src/core/exporter.d.ts +4 -0
  31. package/dist/src/core/exporter.d.ts.map +1 -0
  32. package/dist/src/core/exporter.js +196 -0
  33. package/dist/src/core/exporter.js.map +1 -0
  34. package/dist/src/core/infer.d.ts +6 -0
  35. package/dist/src/core/infer.d.ts.map +1 -0
  36. package/dist/src/core/infer.js +900 -0
  37. package/dist/src/core/infer.js.map +1 -0
  38. package/dist/src/core/updater.d.ts +8 -0
  39. package/dist/src/core/updater.d.ts.map +1 -0
  40. package/dist/src/core/updater.js +120 -0
  41. package/dist/src/core/updater.js.map +1 -0
  42. package/dist/src/core/watcher.d.ts +15 -0
  43. package/dist/src/core/watcher.d.ts.map +1 -0
  44. package/dist/src/core/watcher.js +119 -0
  45. package/dist/src/core/watcher.js.map +1 -0
  46. package/dist/src/schema/architecture.d.ts +75 -0
  47. package/dist/src/schema/architecture.d.ts.map +1 -0
  48. package/dist/src/schema/architecture.js +24 -0
  49. package/dist/src/schema/architecture.js.map +1 -0
  50. package/dist/src/schema/constraints.d.ts +146 -0
  51. package/dist/src/schema/constraints.d.ts.map +1 -0
  52. package/dist/src/schema/constraints.js +39 -0
  53. package/dist/src/schema/constraints.js.map +1 -0
  54. package/dist/src/schema/decisions.d.ts +122 -0
  55. package/dist/src/schema/decisions.d.ts.map +1 -0
  56. package/dist/src/schema/decisions.js +23 -0
  57. package/dist/src/schema/decisions.js.map +1 -0
  58. package/dist/src/schema/index.d.ts +7 -0
  59. package/dist/src/schema/index.d.ts.map +1 -0
  60. package/dist/src/schema/index.js +7 -0
  61. package/dist/src/schema/index.js.map +1 -0
  62. package/dist/src/schema/project.d.ts +69 -0
  63. package/dist/src/schema/project.d.ts.map +1 -0
  64. package/dist/src/schema/project.js +24 -0
  65. package/dist/src/schema/project.js.map +1 -0
  66. package/dist/src/schema/session.d.ts +210 -0
  67. package/dist/src/schema/session.d.ts.map +1 -0
  68. package/dist/src/schema/session.js +26 -0
  69. package/dist/src/schema/session.js.map +1 -0
  70. package/dist/src/schema/stack.d.ts +58 -0
  71. package/dist/src/schema/stack.d.ts.map +1 -0
  72. package/dist/src/schema/stack.js +23 -0
  73. package/dist/src/schema/stack.js.map +1 -0
  74. package/dist/src/utils/fs.d.ts +10 -0
  75. package/dist/src/utils/fs.d.ts.map +1 -0
  76. package/dist/src/utils/fs.js +63 -0
  77. package/dist/src/utils/fs.js.map +1 -0
  78. package/dist/src/utils/log.d.ts +20 -0
  79. package/dist/src/utils/log.d.ts.map +1 -0
  80. package/dist/src/utils/log.js +45 -0
  81. package/dist/src/utils/log.js.map +1 -0
  82. package/dist/src/utils/time.d.ts +5 -0
  83. package/dist/src/utils/time.d.ts.map +1 -0
  84. package/dist/src/utils/time.js +33 -0
  85. package/dist/src/utils/time.js.map +1 -0
  86. package/package.json +64 -0
  87. package/schemas/architecture.schema.json +98 -0
  88. package/schemas/constraints.schema.json +161 -0
  89. package/schemas/decisions.schema.json +95 -0
  90. package/schemas/export.schema.json +46 -0
  91. package/schemas/project.schema.json +102 -0
  92. package/schemas/session.schema.json +101 -0
  93. package/schemas/stack.schema.json +103 -0
  94. package/spec.md +717 -0
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ const PRELUDE_VERSION = "1.0.0";
3
+ const SCHEMA_URL = "https://adjective.us/prelude/schemas/v1";
4
+ export const StackSchema = z.object({
5
+ $schema: z.string().url().default(`${SCHEMA_URL}/stack.json`),
6
+ version: z.string().default(PRELUDE_VERSION),
7
+ language: z.string(),
8
+ runtime: z.string().optional(),
9
+ packageManager: z.enum(['npm', 'pnpm', 'yarn', 'bun', 'pip', 'poetry', 'cargo', 'go']).optional(),
10
+ framework: z.string().optional(),
11
+ frameworks: z.array(z.string()).optional(),
12
+ dependencies: z.record(z.string()).optional(),
13
+ devDependencies: z.record(z.string()).optional(),
14
+ buildTools: z.array(z.string()).optional(),
15
+ testingFrameworks: z.array(z.string()).optional(),
16
+ styling: z.array(z.string()).optional(),
17
+ database: z.string().optional(),
18
+ orm: z.string().optional(),
19
+ stateManagement: z.string().optional(),
20
+ deployment: z.string().optional(),
21
+ cicd: z.array(z.string()).optional()
22
+ });
23
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/schema/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM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G,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function readJSON<T>(path: string): Promise<T>;
2
+ export declare function writeJSON(path: string, data: unknown): Promise<void>;
3
+ export declare function readMarkdown(path: string): Promise<string>;
4
+ export declare function writeMarkdown(path: string, content: string): Promise<void>;
5
+ export declare function ensureDir(path: string): Promise<void>;
6
+ export declare function fileExists(path: string): Promise<boolean>;
7
+ export declare function isDirectory(path: string): Promise<boolean>;
8
+ export declare function listFiles(dir: string): Promise<string[]>;
9
+ export declare function getDirectoryTree(rootDir: string, maxDepth?: number, currentDepth?: number): Promise<string[]>;
10
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/utils/fs.ts"],"names":[],"mappings":"AAIA,wBAAsB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAG1D;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1E;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhE;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhF;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3D;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOhE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAM9D;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,EAAE,YAAY,GAAE,MAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBzH"}
@@ -0,0 +1,63 @@
1
+ import { readFile, writeFile, mkdir, access, readdir, stat } from 'fs/promises';
2
+ import { dirname, join } from 'path';
3
+ import { constants } from 'fs';
4
+ export async function readJSON(path) {
5
+ const content = await readFile(path, 'utf-8');
6
+ return JSON.parse(content);
7
+ }
8
+ export async function writeJSON(path, data) {
9
+ await mkdir(dirname(path), { recursive: true });
10
+ await writeFile(path, JSON.stringify(data, null, 2), 'utf-8');
11
+ }
12
+ export async function readMarkdown(path) {
13
+ return await readFile(path, 'utf-8');
14
+ }
15
+ export async function writeMarkdown(path, content) {
16
+ await mkdir(dirname(path), { recursive: true });
17
+ await writeFile(path, content, 'utf-8');
18
+ }
19
+ export async function ensureDir(path) {
20
+ await mkdir(path, { recursive: true });
21
+ }
22
+ export async function fileExists(path) {
23
+ try {
24
+ await access(path, constants.F_OK);
25
+ return true;
26
+ }
27
+ catch {
28
+ return false;
29
+ }
30
+ }
31
+ export async function isDirectory(path) {
32
+ try {
33
+ const stats = await stat(path);
34
+ return stats.isDirectory();
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
40
+ export async function listFiles(dir) {
41
+ try {
42
+ return await readdir(dir);
43
+ }
44
+ catch {
45
+ return [];
46
+ }
47
+ }
48
+ export async function getDirectoryTree(rootDir, maxDepth = 2, currentDepth = 0) {
49
+ if (currentDepth >= maxDepth)
50
+ return [];
51
+ const dirs = [];
52
+ const entries = await readdir(rootDir, { withFileTypes: true });
53
+ for (const entry of entries) {
54
+ if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules') {
55
+ const fullPath = join(rootDir, entry.name);
56
+ dirs.push(fullPath);
57
+ const subDirs = await getDirectoryTree(fullPath, maxDepth, currentDepth + 1);
58
+ dirs.push(...subDirs);
59
+ }
60
+ }
61
+ return dirs;
62
+ }
63
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAI,IAAY;IAC5C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAY,EAAE,IAAa;IACzD,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,KAAK,U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C,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACxF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEpB,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;YAC7E,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,20 @@
1
+ export declare const logger: {
2
+ info: (msg: string) => void;
3
+ success: (msg: string) => void;
4
+ warn: (msg: string) => void;
5
+ error: (msg: string) => void;
6
+ debug: (msg: string) => void;
7
+ step: (msg: string) => void;
8
+ heading: (msg: string) => void;
9
+ init: (msg: string) => void;
10
+ export: (msg: string) => void;
11
+ decision: (msg: string) => void;
12
+ watch: (msg: string) => void;
13
+ scan: (msg: string) => void;
14
+ write: (msg: string) => void;
15
+ };
16
+ export declare function logTable(data: Record<string, string | number | boolean>): void;
17
+ export declare function spinner(text: string): {
18
+ stop: (finalText?: string) => void;
19
+ };
20
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/utils/log.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;gBACL,MAAM;mBACH,MAAM;gBACT,MAAM;iBACL,MAAM;iBACN,MAAM;gBACP,MAAM;mBACH,MAAM;gBAGT,MAAM;kBACJ,MAAM;oBACJ,MAAM;iBACT,MAAM;gBACP,MAAM;iBACL,MAAM;CACpB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,QASvE;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM;uBAUb,MAAM;EAQ5B"}
@@ -0,0 +1,45 @@
1
+ import { blue, green, red, yellow, cyan, magenta, gray } from 'colorette';
2
+ import logSymbols from 'log-symbols';
3
+ export const logger = {
4
+ info: (msg) => console.log(logSymbols.info, blue(msg)),
5
+ success: (msg) => console.log(logSymbols.success, green(msg)),
6
+ warn: (msg) => console.log(logSymbols.warning, yellow(msg)),
7
+ error: (msg) => console.log(logSymbols.error, red(msg)),
8
+ debug: (msg) => console.log(gray('→'), gray(msg)),
9
+ step: (msg) => console.log(cyan('◆'), cyan(msg)),
10
+ heading: (msg) => console.log('\n' + magenta('━'.repeat(50))),
11
+ // Custom emojis for Prelude-specific actions
12
+ init: (msg) => console.log('🎯', blue(msg)),
13
+ export: (msg) => console.log('📤', green(msg)),
14
+ decision: (msg) => console.log('🧠', cyan(msg)),
15
+ watch: (msg) => console.log('👀', yellow(msg)),
16
+ scan: (msg) => console.log('🔍', blue(msg)),
17
+ write: (msg) => console.log('✍️ ', green(msg))
18
+ };
19
+ export function logTable(data) {
20
+ const maxKeyLength = Math.max(...Object.keys(data).map(k => k.length));
21
+ console.log();
22
+ for (const [key, value] of Object.entries(data)) {
23
+ const paddedKey = key.padEnd(maxKeyLength);
24
+ console.log(` ${gray(paddedKey)} ${cyan('→')} ${value}`);
25
+ }
26
+ console.log();
27
+ }
28
+ export function spinner(text) {
29
+ const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
30
+ let i = 0;
31
+ const interval = setInterval(() => {
32
+ process.stdout.write(`\r${cyan(frames[i])} ${text}`);
33
+ i = (i + 1) % frames.length;
34
+ }, 80);
35
+ return {
36
+ stop: (finalText) => {
37
+ clearInterval(interval);
38
+ process.stdout.write('\r');
39
+ if (finalText) {
40
+ logger.success(finalText);
41
+ }
42
+ }
43
+ };
44
+ }
45
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/utils/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9D,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACrE,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACnE,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/D,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,OAAO,EAAE,CAAC,GA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CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAClE,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,IAAI,EAAE,CAAC,SAAkB,EAAE,EAAE;YAC3B,aAAa,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function getCurrentTimestamp(): string;
2
+ export declare function formatTimestamp(isoString: string): string;
3
+ export declare function getRelativeTime(isoString: string): string;
4
+ export declare function generateId(): string;
5
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/utils/time.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CASzD;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAczD;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
@@ -0,0 +1,33 @@
1
+ export function getCurrentTimestamp() {
2
+ return new Date().toISOString();
3
+ }
4
+ export function formatTimestamp(isoString) {
5
+ const date = new Date(isoString);
6
+ return date.toLocaleString('en-US', {
7
+ year: 'numeric',
8
+ month: 'short',
9
+ day: 'numeric',
10
+ hour: '2-digit',
11
+ minute: '2-digit'
12
+ });
13
+ }
14
+ export function getRelativeTime(isoString) {
15
+ const now = Date.now();
16
+ const then = new Date(isoString).getTime();
17
+ const diff = now - then;
18
+ const seconds = Math.floor(diff / 1000);
19
+ const minutes = Math.floor(seconds / 60);
20
+ const hours = Math.floor(minutes / 60);
21
+ const days = Math.floor(hours / 24);
22
+ if (days > 0)
23
+ return `${days}d ago`;
24
+ if (hours > 0)
25
+ return `${hours}h ago`;
26
+ if (minutes > 0)
27
+ return `${minutes}m ago`;
28
+ return 'just now';
29
+ }
30
+ export function generateId() {
31
+ return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
32
+ }
33
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../../../src/utils/time.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAClC,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3C,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;IAExB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IAEpC,IAAI,IAAI,GAAG,CAAC;QAAE,OAAO,GAAG,IAAI,OAAO,CAAC;IACpC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,GAAG,KAAK,OAAO,CAAC;IACtC,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,GAAG,OAAO,OAAO,CAAC;IAC1C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACvE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "prelude-context",
3
+ "version": "1.0.0",
4
+ "description": "The open standard for expressing and maintaining machine-readable context about a codebase",
5
+ "type": "module",
6
+ "bin": {
7
+ "prelude": "./dist/bin/prelude.js"
8
+ },
9
+ "files": [
10
+ "dist/**/*",
11
+ "schemas/**/*",
12
+ "README.md",
13
+ "SPEC.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "dev": "tsx watch bin/prelude.ts",
18
+ "build": "tsc",
19
+ "prepublishOnly": "pnpm build",
20
+ "test": "vitest",
21
+ "test:watch": "vitest --watch",
22
+ "lint": "eslint . --ext .ts",
23
+ "format": "prettier --write \"**/*.{ts,json,md}\""
24
+ },
25
+ "keywords": [
26
+ "cli",
27
+ "context",
28
+ "ai",
29
+ "agents",
30
+ "llm",
31
+ "codebase",
32
+ "prelude",
33
+ "machine-readable",
34
+ "developer-tools"
35
+ ],
36
+ "author": "Rob Hocking <rob@useadjective.com>",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/adjective-rob/prelude.git"
40
+ },
41
+ "homepage": "https://github.com/adjective-rob/prelude#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/adjective-rob/prelude/issues"
44
+ },
45
+ "license": "MIT",
46
+ "dependencies": {
47
+ "cac": "^6.7.14",
48
+ "chokidar": "^3.6.0",
49
+ "colorette": "^2.0.20",
50
+ "log-symbols": "^6.0.0",
51
+ "zod": "^3.23.8"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^20.14.0",
55
+ "eslint": "^9.5.0",
56
+ "prettier": "^3.3.2",
57
+ "tsx": "^4.15.7",
58
+ "typescript": "^5.5.2",
59
+ "vitest": "^1.6.0"
60
+ },
61
+ "engines": {
62
+ "node": ">=18.0.0"
63
+ }
64
+ }
@@ -0,0 +1,98 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://adjective.us/prelude/schemas/v1/architecture.schema.json",
4
+ "title": "Prelude Architecture Schema",
5
+ "description": "Schema for Prelude architecture.json file containing codebase structure",
6
+ "type": "object",
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "description": "URI of the JSON Schema for this file",
11
+ "format": "uri"
12
+ },
13
+ "version": {
14
+ "type": "string",
15
+ "description": "Semantic version of Prelude format",
16
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
17
+ },
18
+ "type": {
19
+ "type": "string",
20
+ "enum": ["monolith", "monorepo", "microservices", "library", "cli", "fullstack", "backend", "frontend"],
21
+ "description": "Project architecture type"
22
+ },
23
+ "directories": {
24
+ "type": "array",
25
+ "description": "Key directories with metadata",
26
+ "items": {
27
+ "type": "object",
28
+ "required": ["path"],
29
+ "properties": {
30
+ "path": {
31
+ "type": "string",
32
+ "description": "Directory path relative to project root"
33
+ },
34
+ "purpose": {
35
+ "type": "string",
36
+ "description": "Purpose or description of directory"
37
+ },
38
+ "fileCount": {
39
+ "type": "integer",
40
+ "description": "Number of files in directory",
41
+ "minimum": 0
42
+ }
43
+ }
44
+ }
45
+ },
46
+ "patterns": {
47
+ "type": "array",
48
+ "description": "Architectural patterns used",
49
+ "items": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "conventions": {
54
+ "type": "array",
55
+ "description": "Code conventions",
56
+ "items": {
57
+ "type": "string"
58
+ }
59
+ },
60
+ "entryPoints": {
61
+ "type": "array",
62
+ "description": "Application entry points",
63
+ "items": {
64
+ "type": "object",
65
+ "required": ["file", "purpose"],
66
+ "properties": {
67
+ "file": {
68
+ "type": "string",
69
+ "description": "File path"
70
+ },
71
+ "purpose": {
72
+ "type": "string",
73
+ "description": "Purpose of entry point"
74
+ }
75
+ }
76
+ }
77
+ },
78
+ "routing": {
79
+ "type": "string",
80
+ "enum": ["file-based", "config-based", "none"],
81
+ "description": "Routing style"
82
+ },
83
+ "stateManagement": {
84
+ "type": "string",
85
+ "description": "State management approach"
86
+ },
87
+ "apiStyle": {
88
+ "type": "string",
89
+ "enum": ["REST", "GraphQL", "tRPC", "gRPC", "mixed", "none"],
90
+ "description": "API architectural style"
91
+ },
92
+ "dataFlow": {
93
+ "type": "string",
94
+ "description": "Data flow description"
95
+ }
96
+ },
97
+ "additionalProperties": true
98
+ }
@@ -0,0 +1,161 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://adjective.us/prelude/schemas/v1/constraints.schema.json",
4
+ "title": "Prelude Constraints Schema",
5
+ "description": "Schema for Prelude constraints.json file containing development rules and preferences",
6
+ "type": "object",
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "description": "URI of the JSON Schema for this file",
11
+ "format": "uri"
12
+ },
13
+ "version": {
14
+ "type": "string",
15
+ "description": "Semantic version of Prelude format",
16
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
17
+ },
18
+ "mustUse": {
19
+ "type": "array",
20
+ "description": "Required technologies or practices",
21
+ "items": {
22
+ "type": "string"
23
+ }
24
+ },
25
+ "mustNotUse": {
26
+ "type": "array",
27
+ "description": "Prohibited technologies or practices",
28
+ "items": {
29
+ "type": "string"
30
+ }
31
+ },
32
+ "preferences": {
33
+ "type": "array",
34
+ "description": "Preferred approaches with rationale",
35
+ "items": {
36
+ "type": "object",
37
+ "required": ["category", "preference"],
38
+ "properties": {
39
+ "category": {
40
+ "type": "string",
41
+ "description": "Category of preference"
42
+ },
43
+ "preference": {
44
+ "type": "string",
45
+ "description": "Preferred approach"
46
+ },
47
+ "rationale": {
48
+ "type": "string",
49
+ "description": "Reason for preference"
50
+ }
51
+ }
52
+ }
53
+ },
54
+ "codeStyle": {
55
+ "type": "object",
56
+ "description": "Code style configuration",
57
+ "properties": {
58
+ "formatter": {
59
+ "type": "string",
60
+ "description": "Code formatter (e.g., Prettier)"
61
+ },
62
+ "linter": {
63
+ "type": "string",
64
+ "description": "Code linter (e.g., ESLint)"
65
+ },
66
+ "rules": {
67
+ "type": "array",
68
+ "description": "Linting rules or configurations",
69
+ "items": {
70
+ "type": "string"
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "naming": {
76
+ "type": "object",
77
+ "description": "Naming conventions",
78
+ "properties": {
79
+ "files": {
80
+ "type": "string",
81
+ "description": "File naming convention"
82
+ },
83
+ "components": {
84
+ "type": "string",
85
+ "description": "Component naming convention"
86
+ },
87
+ "functions": {
88
+ "type": "string",
89
+ "description": "Function naming convention"
90
+ },
91
+ "variables": {
92
+ "type": "string",
93
+ "description": "Variable naming convention"
94
+ }
95
+ }
96
+ },
97
+ "fileOrganization": {
98
+ "type": "array",
99
+ "description": "File organization rules",
100
+ "items": {
101
+ "type": "string"
102
+ }
103
+ },
104
+ "testing": {
105
+ "type": "object",
106
+ "description": "Testing requirements",
107
+ "properties": {
108
+ "required": {
109
+ "type": "boolean",
110
+ "description": "Whether testing is required"
111
+ },
112
+ "coverage": {
113
+ "type": "number",
114
+ "description": "Required test coverage percentage",
115
+ "minimum": 0,
116
+ "maximum": 100
117
+ },
118
+ "strategy": {
119
+ "type": "string",
120
+ "description": "Testing strategy description"
121
+ }
122
+ }
123
+ },
124
+ "documentation": {
125
+ "type": "object",
126
+ "description": "Documentation requirements",
127
+ "properties": {
128
+ "required": {
129
+ "type": "boolean",
130
+ "description": "Whether documentation is required"
131
+ },
132
+ "style": {
133
+ "type": "string",
134
+ "description": "Documentation style or format"
135
+ }
136
+ }
137
+ },
138
+ "performance": {
139
+ "type": "array",
140
+ "description": "Performance constraints",
141
+ "items": {
142
+ "type": "string"
143
+ }
144
+ },
145
+ "security": {
146
+ "type": "array",
147
+ "description": "Security requirements",
148
+ "items": {
149
+ "type": "string"
150
+ }
151
+ },
152
+ "accessibility": {
153
+ "type": "array",
154
+ "description": "Accessibility requirements",
155
+ "items": {
156
+ "type": "string"
157
+ }
158
+ }
159
+ },
160
+ "additionalProperties": true
161
+ }
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://adjective.us/prelude/schemas/v1/decisions.schema.json",
4
+ "title": "Prelude Decisions Schema",
5
+ "description": "Schema for Prelude decisions.json file containing architectural decision records",
6
+ "type": "object",
7
+ "required": ["decisions"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "URI of the JSON Schema for this file",
12
+ "format": "uri"
13
+ },
14
+ "version": {
15
+ "type": "string",
16
+ "description": "Semantic version of Prelude format",
17
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
18
+ },
19
+ "decisions": {
20
+ "type": "array",
21
+ "description": "List of architectural decisions",
22
+ "items": {
23
+ "type": "object",
24
+ "required": ["id", "timestamp", "title", "status", "rationale"],
25
+ "properties": {
26
+ "id": {
27
+ "type": "string",
28
+ "description": "Unique decision identifier"
29
+ },
30
+ "timestamp": {
31
+ "type": "string",
32
+ "description": "ISO 8601 datetime when decision was made",
33
+ "format": "date-time"
34
+ },
35
+ "title": {
36
+ "type": "string",
37
+ "description": "Brief decision title",
38
+ "minLength": 1
39
+ },
40
+ "status": {
41
+ "type": "string",
42
+ "enum": ["proposed", "accepted", "rejected", "deprecated", "superseded"],
43
+ "description": "Decision status"
44
+ },
45
+ "rationale": {
46
+ "type": "string",
47
+ "description": "Reasoning behind the decision",
48
+ "minLength": 1
49
+ },
50
+ "alternatives": {
51
+ "type": "array",
52
+ "description": "Alternative approaches considered",
53
+ "items": {
54
+ "type": "string"
55
+ }
56
+ },
57
+ "consequences": {
58
+ "type": "array",
59
+ "description": "Consequences of the decision",
60
+ "items": {
61
+ "type": "string"
62
+ }
63
+ },
64
+ "impact": {
65
+ "type": "string",
66
+ "description": "Impact assessment"
67
+ },
68
+ "author": {
69
+ "type": "string",
70
+ "description": "Decision author"
71
+ },
72
+ "tags": {
73
+ "type": "array",
74
+ "description": "Decision tags for categorization",
75
+ "items": {
76
+ "type": "string"
77
+ }
78
+ },
79
+ "references": {
80
+ "type": "array",
81
+ "description": "References or supporting documentation",
82
+ "items": {
83
+ "type": "string"
84
+ }
85
+ },
86
+ "supersededBy": {
87
+ "type": "string",
88
+ "description": "ID of decision that supersedes this one"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "additionalProperties": true
95
+ }