dino-spec 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.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +243 -0
  3. package/bin/dino.js +3 -0
  4. package/dist/cli/index.d.ts +3 -0
  5. package/dist/cli/index.d.ts.map +1 -0
  6. package/dist/cli/index.js +114 -0
  7. package/dist/cli/index.js.map +1 -0
  8. package/dist/commands/active.d.ts +5 -0
  9. package/dist/commands/active.d.ts.map +1 -0
  10. package/dist/commands/active.js +85 -0
  11. package/dist/commands/active.js.map +1 -0
  12. package/dist/commands/archive.d.ts +9 -0
  13. package/dist/commands/archive.d.ts.map +1 -0
  14. package/dist/commands/archive.js +77 -0
  15. package/dist/commands/archive.js.map +1 -0
  16. package/dist/commands/init.d.ts +9 -0
  17. package/dist/commands/init.d.ts.map +1 -0
  18. package/dist/commands/init.js +91 -0
  19. package/dist/commands/init.js.map +1 -0
  20. package/dist/commands/list.d.ts +12 -0
  21. package/dist/commands/list.d.ts.map +1 -0
  22. package/dist/commands/list.js +169 -0
  23. package/dist/commands/list.js.map +1 -0
  24. package/dist/commands/skill.d.ts +17 -0
  25. package/dist/commands/skill.d.ts.map +1 -0
  26. package/dist/commands/skill.js +143 -0
  27. package/dist/commands/skill.js.map +1 -0
  28. package/dist/commands/status.d.ts +9 -0
  29. package/dist/commands/status.d.ts.map +1 -0
  30. package/dist/commands/status.js +96 -0
  31. package/dist/commands/status.js.map +1 -0
  32. package/dist/commands/update.d.ts +9 -0
  33. package/dist/commands/update.d.ts.map +1 -0
  34. package/dist/commands/update.js +64 -0
  35. package/dist/commands/update.js.map +1 -0
  36. package/dist/commands/view.d.ts +5 -0
  37. package/dist/commands/view.d.ts.map +1 -0
  38. package/dist/commands/view.js +177 -0
  39. package/dist/commands/view.js.map +1 -0
  40. package/dist/core/config.d.ts +51 -0
  41. package/dist/core/config.d.ts.map +1 -0
  42. package/dist/core/config.js +58 -0
  43. package/dist/core/config.js.map +1 -0
  44. package/dist/core/skills/index.d.ts +7 -0
  45. package/dist/core/skills/index.d.ts.map +1 -0
  46. package/dist/core/skills/index.js +6 -0
  47. package/dist/core/skills/index.js.map +1 -0
  48. package/dist/core/skills/loader.d.ts +34 -0
  49. package/dist/core/skills/loader.d.ts.map +1 -0
  50. package/dist/core/skills/loader.js +110 -0
  51. package/dist/core/skills/loader.js.map +1 -0
  52. package/dist/core/skills/registry.d.ts +31 -0
  53. package/dist/core/skills/registry.d.ts.map +1 -0
  54. package/dist/core/skills/registry.js +150 -0
  55. package/dist/core/skills/registry.js.map +1 -0
  56. package/dist/core/skills/types.d.ts +33 -0
  57. package/dist/core/skills/types.d.ts.map +1 -0
  58. package/dist/core/skills/types.js +5 -0
  59. package/dist/core/skills/types.js.map +1 -0
  60. package/dist/core/templates/dna-template.d.ts +5 -0
  61. package/dist/core/templates/dna-template.d.ts.map +1 -0
  62. package/dist/core/templates/dna-template.js +52 -0
  63. package/dist/core/templates/dna-template.js.map +1 -0
  64. package/dist/core/templates/index.d.ts +8 -0
  65. package/dist/core/templates/index.d.ts.map +1 -0
  66. package/dist/core/templates/index.js +8 -0
  67. package/dist/core/templates/index.js.map +1 -0
  68. package/dist/core/templates/rules-template.d.ts +5 -0
  69. package/dist/core/templates/rules-template.d.ts.map +1 -0
  70. package/dist/core/templates/rules-template.js +71 -0
  71. package/dist/core/templates/rules-template.js.map +1 -0
  72. package/dist/core/templates/skill-template.d.ts +5 -0
  73. package/dist/core/templates/skill-template.d.ts.map +1 -0
  74. package/dist/core/templates/skill-template.js +63 -0
  75. package/dist/core/templates/skill-template.js.map +1 -0
  76. package/dist/core/templates/slash-commands.d.ts +5 -0
  77. package/dist/core/templates/slash-commands.d.ts.map +1 -0
  78. package/dist/core/templates/slash-commands.js +753 -0
  79. package/dist/core/templates/slash-commands.js.map +1 -0
  80. package/dist/index.d.ts +7 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +7 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/utils/ascii-art.d.ts +38 -0
  85. package/dist/utils/ascii-art.d.ts.map +1 -0
  86. package/dist/utils/ascii-art.js +66 -0
  87. package/dist/utils/ascii-art.js.map +1 -0
  88. package/dist/utils/file-system.d.ts +67 -0
  89. package/dist/utils/file-system.d.ts.map +1 -0
  90. package/dist/utils/file-system.js +177 -0
  91. package/dist/utils/file-system.js.map +1 -0
  92. package/package.json +68 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../../src/core/templates/slash-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,QAAQ,EAAE,mBAAmB,EAAE;QAC/B,KAAK,EAAE,gBAAgB,EAAE;QACzB,OAAO,EAAE,kBAAkB,EAAE;QAC7B,IAAI,EAAE,eAAe,EAAE;QACvB,KAAK,EAAE,gBAAgB,EAAE;QACzB,IAAI,EAAE,eAAe,EAAE;QACvB,MAAM,EAAE,iBAAiB,EAAE;QAC3B,IAAI,EAAE,eAAe,EAAE;QACvB,GAAG,EAAE,qBAAqB,EAAE;QAC5B,KAAK,EAAE,uBAAuB,EAAE;KACjC,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqER,CAAC;AACF,CAAC;AAED,SAAS,gBAAgB;IACvB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8ER,CAAC;AACF,CAAC;AAED,SAAS,kBAAkB;IACzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDR,CAAC;AACF,CAAC;AAED,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFR,CAAC;AACF,CAAC;AAED,SAAS,gBAAgB;IACvB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFR,CAAC;AACF,CAAC;AAED,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DR,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DR,CAAC;AACF,CAAC;AAED,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDR,CAAC;AACF,CAAC;AAED,SAAS,qBAAqB;IAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuFR,CAAC;AACF,CAAC;AAED,SAAS,uBAAuB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwER,CAAC;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * dino-spec - Claude Code workflow system with dinosaur-themed specification phases
3
+ */
4
+ export * from './core/config.js';
5
+ export * from './utils/file-system.js';
6
+ export * from './utils/ascii-art.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * dino-spec - Claude Code workflow system with dinosaur-themed specification phases
3
+ */
4
+ export * from './core/config.js';
5
+ export * from './utils/file-system.js';
6
+ export * from './utils/ascii-art.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * ASCII art dinosaur (2A style)
3
+ */
4
+ export declare const DINO_ASCII = "\n __\n (_ \\\n .-^^^ /\n / /\n<__|-|__|\n";
5
+ /**
6
+ * Get colored dino ASCII art
7
+ */
8
+ export declare function getDinoArt(color?: 'green' | 'yellow' | 'red' | 'cyan'): string;
9
+ /**
10
+ * Get dino header with title
11
+ */
12
+ export declare function getDinoHeader(title: string, version?: string): string;
13
+ /**
14
+ * Get success dino
15
+ */
16
+ export declare function getSuccessDino(message: string): string;
17
+ /**
18
+ * Get error dino
19
+ */
20
+ export declare function getErrorDino(message: string): string;
21
+ /**
22
+ * Get warning dino
23
+ */
24
+ export declare function getWarningDino(message: string): string;
25
+ /**
26
+ * Phase-specific messages
27
+ */
28
+ export declare const PHASE_MESSAGES: {
29
+ readonly discover: "Discovering new territory...";
30
+ readonly scout: "Scouting the codebase...";
31
+ readonly clarify: "Clarifying requirements...";
32
+ readonly nest: "Building the nest (plan)...";
33
+ readonly hatch: "Hatching tasks...";
34
+ readonly hunt: "On the hunt (implementing)...";
35
+ readonly fossil: "Creating fossils (archiving)...";
36
+ readonly next: "Evolving to the next step...";
37
+ };
38
+ //# sourceMappingURL=ascii-art.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ascii-art.d.ts","sourceRoot":"","sources":["../../src/utils/ascii-art.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU,kEAMtB,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,GAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAgB,GAAG,MAAM,CAGvF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAMrE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAItD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAItD;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;CASjB,CAAC"}
@@ -0,0 +1,66 @@
1
+ import chalk from 'chalk';
2
+ /**
3
+ * ASCII art dinosaur (2A style)
4
+ */
5
+ export const DINO_ASCII = `
6
+ __
7
+ (_ \\
8
+ .-^^^ /
9
+ / /
10
+ <__|-|__|
11
+ `;
12
+ /**
13
+ * Get colored dino ASCII art
14
+ */
15
+ export function getDinoArt(color = 'green') {
16
+ const colorFn = chalk[color];
17
+ return colorFn(DINO_ASCII);
18
+ }
19
+ /**
20
+ * Get dino header with title
21
+ */
22
+ export function getDinoHeader(title, version) {
23
+ const versionStr = version ? chalk.dim(` v${version}`) : '';
24
+ return `${getDinoArt('green')}
25
+ ${chalk.bold.green('dino-spec')}${versionStr}
26
+ ${chalk.dim(title)}
27
+ `;
28
+ }
29
+ /**
30
+ * Get success dino
31
+ */
32
+ export function getSuccessDino(message) {
33
+ return `${getDinoArt('green')}
34
+ ${chalk.green('✓')} ${message}
35
+ `;
36
+ }
37
+ /**
38
+ * Get error dino
39
+ */
40
+ export function getErrorDino(message) {
41
+ return `${getDinoArt('red')}
42
+ ${chalk.red('✗')} ${message}
43
+ `;
44
+ }
45
+ /**
46
+ * Get warning dino
47
+ */
48
+ export function getWarningDino(message) {
49
+ return `${getDinoArt('yellow')}
50
+ ${chalk.yellow('⚠')} ${message}
51
+ `;
52
+ }
53
+ /**
54
+ * Phase-specific messages
55
+ */
56
+ export const PHASE_MESSAGES = {
57
+ discover: 'Discovering new territory...',
58
+ scout: 'Scouting the codebase...',
59
+ clarify: 'Clarifying requirements...',
60
+ nest: 'Building the nest (plan)...',
61
+ hatch: 'Hatching tasks...',
62
+ hunt: 'On the hunt (implementing)...',
63
+ fossil: 'Creating fossils (archiving)...',
64
+ next: 'Evolving to the next step...',
65
+ };
66
+ //# sourceMappingURL=ascii-art.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ascii-art.js","sourceRoot":"","sources":["../../src/utils/ascii-art.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;CAMzB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,QAA6C,OAAO;IAC7E,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,OAAgB;IAC3D,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,UAAU;IAC1C,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;CACnB,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IAC3B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,OAAO;CAC9B,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC;IACzB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO;CAC5B,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC;IAC5B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO;CAC/B,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,8BAA8B;IACxC,KAAK,EAAE,0BAA0B;IACjC,OAAO,EAAE,4BAA4B;IACrC,IAAI,EAAE,6BAA6B;IACnC,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,+BAA+B;IACrC,MAAM,EAAE,iCAAiC;IACzC,IAAI,EAAE,8BAA8B;CAC5B,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * File system utilities for dino-spec
3
+ */
4
+ export declare class FileSystem {
5
+ /**
6
+ * Check if a file or directory exists
7
+ */
8
+ static exists(path: string): Promise<boolean>;
9
+ /**
10
+ * Check if path is a directory
11
+ */
12
+ static isDirectory(path: string): Promise<boolean>;
13
+ /**
14
+ * Create directory recursively
15
+ */
16
+ static createDirectory(path: string): Promise<void>;
17
+ /**
18
+ * Read file contents as string
19
+ */
20
+ static readFile(path: string): Promise<string>;
21
+ /**
22
+ * Read file contents, return null if doesn't exist
23
+ */
24
+ static readFileSafe(path: string): Promise<string | null>;
25
+ /**
26
+ * Write content to file, creating directories if needed
27
+ */
28
+ static writeFile(path: string, content: string): Promise<void>;
29
+ /**
30
+ * Read JSON file
31
+ */
32
+ static readJson<T>(path: string): Promise<T>;
33
+ /**
34
+ * Read JSON file safely, return null if doesn't exist
35
+ */
36
+ static readJsonSafe<T>(path: string): Promise<T | null>;
37
+ /**
38
+ * Write JSON to file
39
+ */
40
+ static writeJson(path: string, data: unknown): Promise<void>;
41
+ /**
42
+ * List directory contents
43
+ */
44
+ static listDirectory(path: string): Promise<string[]>;
45
+ /**
46
+ * Remove file or directory
47
+ */
48
+ static remove(path: string): Promise<void>;
49
+ /**
50
+ * Move/rename file or directory
51
+ */
52
+ static move(source: string, destination: string): Promise<void>;
53
+ /**
54
+ * Update file content between markers, preserving content outside markers
55
+ * If markers don't exist, appends the section at the end
56
+ */
57
+ static updateWithMarkers(path: string, content: string, startMarker?: string, endMarker?: string): Promise<void>;
58
+ /**
59
+ * Merge JSON object into existing file (shallow merge)
60
+ */
61
+ static mergeJson<T extends Record<string, unknown>>(path: string, data: Partial<T>): Promise<void>;
62
+ /**
63
+ * Deep merge JSON object into existing file
64
+ */
65
+ static deepMergeJson<T extends Record<string, unknown>>(path: string, data: Partial<T>): Promise<void>;
66
+ }
67
+ //# sourceMappingURL=file-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../src/utils/file-system.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,qBAAa,UAAU;IACrB;;OAEG;WACU,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASnD;;OAEG;WACU,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASxD;;OAEG;WACU,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD;;OAEG;WACU,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpD;;OAEG;WACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQ/D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dir, stat, rm, rename } from 'fs/promises';
2
+ import { dirname } from 'path';
3
+ import { DINO_MARKERS } from '../core/config.js';
4
+ /**
5
+ * File system utilities for dino-spec
6
+ */
7
+ export class FileSystem {
8
+ /**
9
+ * Check if a file or directory exists
10
+ */
11
+ static async exists(path) {
12
+ try {
13
+ await access(path);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ /**
21
+ * Check if path is a directory
22
+ */
23
+ static async isDirectory(path) {
24
+ try {
25
+ const stats = await stat(path);
26
+ return stats.isDirectory();
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
32
+ /**
33
+ * Create directory recursively
34
+ */
35
+ static async createDirectory(path) {
36
+ await mkdir(path, { recursive: true });
37
+ }
38
+ /**
39
+ * Read file contents as string
40
+ */
41
+ static async readFile(path) {
42
+ return readFile(path, 'utf-8');
43
+ }
44
+ /**
45
+ * Read file contents, return null if doesn't exist
46
+ */
47
+ static async readFileSafe(path) {
48
+ try {
49
+ return await readFile(path, 'utf-8');
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
55
+ /**
56
+ * Write content to file, creating directories if needed
57
+ */
58
+ static async writeFile(path, content) {
59
+ await mkdir(dirname(path), { recursive: true });
60
+ await writeFile(path, content, 'utf-8');
61
+ }
62
+ /**
63
+ * Read JSON file
64
+ */
65
+ static async readJson(path) {
66
+ const content = await readFile(path, 'utf-8');
67
+ return JSON.parse(content);
68
+ }
69
+ /**
70
+ * Read JSON file safely, return null if doesn't exist
71
+ */
72
+ static async readJsonSafe(path) {
73
+ try {
74
+ const content = await readFile(path, 'utf-8');
75
+ return JSON.parse(content);
76
+ }
77
+ catch {
78
+ return null;
79
+ }
80
+ }
81
+ /**
82
+ * Write JSON to file
83
+ */
84
+ static async writeJson(path, data) {
85
+ await mkdir(dirname(path), { recursive: true });
86
+ await writeFile(path, JSON.stringify(data, null, 2), 'utf-8');
87
+ }
88
+ /**
89
+ * List directory contents
90
+ */
91
+ static async listDirectory(path) {
92
+ try {
93
+ return await readdir(path);
94
+ }
95
+ catch {
96
+ return [];
97
+ }
98
+ }
99
+ /**
100
+ * Remove file or directory
101
+ */
102
+ static async remove(path) {
103
+ await rm(path, { recursive: true, force: true });
104
+ }
105
+ /**
106
+ * Move/rename file or directory
107
+ */
108
+ static async move(source, destination) {
109
+ await mkdir(dirname(destination), { recursive: true });
110
+ await rename(source, destination);
111
+ }
112
+ /**
113
+ * Update file content between markers, preserving content outside markers
114
+ * If markers don't exist, appends the section at the end
115
+ */
116
+ static async updateWithMarkers(path, content, startMarker = DINO_MARKERS.start, endMarker = DINO_MARKERS.end) {
117
+ const existingContent = await this.readFileSafe(path);
118
+ if (!existingContent) {
119
+ // File doesn't exist, create with markers
120
+ await this.writeFile(path, `${startMarker}\n${content}\n${endMarker}\n`);
121
+ return;
122
+ }
123
+ const startIndex = existingContent.indexOf(startMarker);
124
+ const endIndex = existingContent.indexOf(endMarker);
125
+ if (startIndex === -1 || endIndex === -1) {
126
+ // Markers don't exist, append at end
127
+ const newContent = existingContent.trimEnd() +
128
+ `\n\n${startMarker}\n${content}\n${endMarker}\n`;
129
+ await this.writeFile(path, newContent);
130
+ return;
131
+ }
132
+ // Replace content between markers
133
+ const before = existingContent.substring(0, startIndex + startMarker.length);
134
+ const after = existingContent.substring(endIndex);
135
+ const newContent = `${before}\n${content}\n${after}`;
136
+ await this.writeFile(path, newContent);
137
+ }
138
+ /**
139
+ * Merge JSON object into existing file (shallow merge)
140
+ */
141
+ static async mergeJson(path, data) {
142
+ const existing = await this.readJsonSafe(path) ?? {};
143
+ const merged = { ...existing, ...data };
144
+ await this.writeJson(path, merged);
145
+ }
146
+ /**
147
+ * Deep merge JSON object into existing file
148
+ */
149
+ static async deepMergeJson(path, data) {
150
+ const existing = await this.readJsonSafe(path) ?? {};
151
+ const merged = deepMerge(existing, data);
152
+ await this.writeJson(path, merged);
153
+ }
154
+ }
155
+ /**
156
+ * Deep merge two objects
157
+ */
158
+ function deepMerge(target, source) {
159
+ const result = { ...target };
160
+ for (const key in source) {
161
+ const sourceValue = source[key];
162
+ const targetValue = target[key];
163
+ if (sourceValue !== null &&
164
+ typeof sourceValue === 'object' &&
165
+ !Array.isArray(sourceValue) &&
166
+ targetValue !== null &&
167
+ typeof targetValue === 'object' &&
168
+ !Array.isArray(targetValue)) {
169
+ result[key] = deepMerge(targetValue, sourceValue);
170
+ }
171
+ else {
172
+ result[key] = sourceValue;
173
+ }
174
+ }
175
+ return result;
176
+ }
177
+ //# sourceMappingURL=file-system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.js","sourceRoot":"","sources":["../../src/utils/file-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAQ,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,UAAU;IACrB;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAY;QAC9B,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAY;QACvC,M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G,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACzC,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CACF;AAED;;GAEG;AACH,SAAS,SAAS,CAChB,MAAS,EACT,MAAkB;IAElB,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAE7B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAEhC,IACE,WAAW,KAAK,IAAI;YACpB,OAAO,WAAW,KAAK,QAAQ;YAC/B,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;YAC3B,WAAW,KAAK,IAAI;YACpB,OAAO,WAAW,KAAK,QAAQ;YAC/B,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAC3B,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CACrB,WAAsC,EACtC,WAAsC,CACtB,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,WAA4B,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "dino-spec",
3
+ "version": "0.1.0",
4
+ "description": "Claude Code workflow system with dinosaur-themed specification phases",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ }
11
+ },
12
+ "bin": {
13
+ "dino": "./bin/dino.js"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "bin"
18
+ ],
19
+ "scripts": {
20
+ "build": "node build.js",
21
+ "dev": "tsc --watch",
22
+ "dev:cli": "pnpm build && node bin/dino.js",
23
+ "lint": "eslint src/",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest",
26
+ "prepare": "pnpm run build",
27
+ "prepublishOnly": "pnpm run build"
28
+ },
29
+ "engines": {
30
+ "node": ">=20.0.0"
31
+ },
32
+ "dependencies": {
33
+ "chalk": "^5.4.1",
34
+ "commander": "^13.1.0",
35
+ "fast-glob": "^3.3.3",
36
+ "ora": "^8.1.1",
37
+ "yaml": "^2.7.0",
38
+ "zod": "^3.24.1"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^22.10.5",
42
+ "typescript": "^5.7.3",
43
+ "vitest": "^2.1.8"
44
+ },
45
+ "keywords": [
46
+ "claude",
47
+ "claude-code",
48
+ "specs",
49
+ "workflow",
50
+ "cli",
51
+ "ai",
52
+ "development",
53
+ "specification"
54
+ ],
55
+ "author": "keenu",
56
+ "license": "MIT",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/xullul/dino-spec.git"
60
+ },
61
+ "bugs": {
62
+ "url": "https://github.com/xullul/dino-spec/issues"
63
+ },
64
+ "homepage": "https://github.com/xullul/dino-spec#readme",
65
+ "publishConfig": {
66
+ "access": "public"
67
+ }
68
+ }