@spekn/cli 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 (159) hide show
  1. package/dist/__tests__/export-cli.test.d.ts +1 -0
  2. package/dist/__tests__/export-cli.test.js +70 -0
  3. package/dist/__tests__/tui-args-policy.test.d.ts +1 -0
  4. package/dist/__tests__/tui-args-policy.test.js +50 -0
  5. package/dist/acp-S2MHZOAD.mjs +23 -0
  6. package/dist/acp-UCCI44JY.mjs +25 -0
  7. package/dist/auth/credentials-store.d.ts +2 -0
  8. package/dist/auth/credentials-store.js +5 -0
  9. package/dist/auth/device-flow.d.ts +36 -0
  10. package/dist/auth/device-flow.js +189 -0
  11. package/dist/auth/jwt.d.ts +1 -0
  12. package/dist/auth/jwt.js +6 -0
  13. package/dist/auth/session.d.ts +67 -0
  14. package/dist/auth/session.js +86 -0
  15. package/dist/auth-login.d.ts +34 -0
  16. package/dist/auth-login.js +202 -0
  17. package/dist/auth-logout.d.ts +25 -0
  18. package/dist/auth-logout.js +115 -0
  19. package/dist/auth-status.d.ts +24 -0
  20. package/dist/auth-status.js +109 -0
  21. package/dist/backlog-generate.d.ts +11 -0
  22. package/dist/backlog-generate.js +308 -0
  23. package/dist/backlog-health.d.ts +11 -0
  24. package/dist/backlog-health.js +287 -0
  25. package/dist/bridge-login.d.ts +40 -0
  26. package/dist/bridge-login.js +277 -0
  27. package/dist/chunk-3PAYRI4G.mjs +2428 -0
  28. package/dist/chunk-M4CS3A25.mjs +2426 -0
  29. package/dist/commands/auth/login.d.ts +30 -0
  30. package/dist/commands/auth/login.js +164 -0
  31. package/dist/commands/auth/logout.d.ts +25 -0
  32. package/dist/commands/auth/logout.js +115 -0
  33. package/dist/commands/auth/status.d.ts +24 -0
  34. package/dist/commands/auth/status.js +109 -0
  35. package/dist/commands/backlog/generate.d.ts +11 -0
  36. package/dist/commands/backlog/generate.js +308 -0
  37. package/dist/commands/backlog/health.d.ts +11 -0
  38. package/dist/commands/backlog/health.js +287 -0
  39. package/dist/commands/bridge/login.d.ts +36 -0
  40. package/dist/commands/bridge/login.js +258 -0
  41. package/dist/commands/export.d.ts +35 -0
  42. package/dist/commands/export.js +485 -0
  43. package/dist/commands/marketplace-export.d.ts +21 -0
  44. package/dist/commands/marketplace-export.js +214 -0
  45. package/dist/commands/project-clean.d.ts +1 -0
  46. package/dist/commands/project-clean.js +126 -0
  47. package/dist/commands/repo/common.d.ts +105 -0
  48. package/dist/commands/repo/common.js +775 -0
  49. package/dist/commands/repo/detach.d.ts +2 -0
  50. package/dist/commands/repo/detach.js +120 -0
  51. package/dist/commands/repo/register.d.ts +21 -0
  52. package/dist/commands/repo/register.js +175 -0
  53. package/dist/commands/repo/sync.d.ts +22 -0
  54. package/dist/commands/repo/sync.js +873 -0
  55. package/dist/commands/skills-import-local.d.ts +16 -0
  56. package/dist/commands/skills-import-local.js +352 -0
  57. package/dist/commands/spec/drift-check.d.ts +3 -0
  58. package/dist/commands/spec/drift-check.js +186 -0
  59. package/dist/commands/spec/frontmatter.d.ts +11 -0
  60. package/dist/commands/spec/frontmatter.js +219 -0
  61. package/dist/commands/spec/lint.d.ts +11 -0
  62. package/dist/commands/spec/lint.js +499 -0
  63. package/dist/commands/spec/parse.d.ts +11 -0
  64. package/dist/commands/spec/parse.js +162 -0
  65. package/dist/export.d.ts +35 -0
  66. package/dist/export.js +485 -0
  67. package/dist/index.d.ts +11 -0
  68. package/dist/index.js +21 -0
  69. package/dist/main.d.ts +1 -0
  70. package/dist/main.js +115280 -0
  71. package/dist/marketplace-export.d.ts +21 -0
  72. package/dist/marketplace-export.js +214 -0
  73. package/dist/project-clean.d.ts +1 -0
  74. package/dist/project-clean.js +126 -0
  75. package/dist/project-context.d.ts +99 -0
  76. package/dist/project-context.js +376 -0
  77. package/dist/repo-common.d.ts +101 -0
  78. package/dist/repo-common.js +671 -0
  79. package/dist/repo-detach.d.ts +2 -0
  80. package/dist/repo-detach.js +102 -0
  81. package/dist/repo-ingest.d.ts +29 -0
  82. package/dist/repo-ingest.js +305 -0
  83. package/dist/repo-register.d.ts +21 -0
  84. package/dist/repo-register.js +175 -0
  85. package/dist/repo-sync.d.ts +16 -0
  86. package/dist/repo-sync.js +152 -0
  87. package/dist/resources/prompt-loader.d.ts +1 -0
  88. package/dist/resources/prompt-loader.js +62 -0
  89. package/dist/resources/prompts/README.md +21 -0
  90. package/dist/resources/prompts/prompts/repo-analysis.prompt.md +126 -0
  91. package/dist/resources/prompts/repo-analysis.prompt.md +151 -0
  92. package/dist/resources/prompts/repo-sync-analysis.prompt.md +85 -0
  93. package/dist/skills-import-local.d.ts +16 -0
  94. package/dist/skills-import-local.js +352 -0
  95. package/dist/spec-drift-check.d.ts +3 -0
  96. package/dist/spec-drift-check.js +186 -0
  97. package/dist/spec-frontmatter.d.ts +11 -0
  98. package/dist/spec-frontmatter.js +219 -0
  99. package/dist/spec-lint.d.ts +11 -0
  100. package/dist/spec-lint.js +499 -0
  101. package/dist/spec-parse.d.ts +11 -0
  102. package/dist/spec-parse.js +162 -0
  103. package/dist/stubs/dotenv.d.ts +5 -0
  104. package/dist/stubs/dotenv.js +6 -0
  105. package/dist/stubs/typeorm.d.ts +22 -0
  106. package/dist/stubs/typeorm.js +28 -0
  107. package/dist/tui/app.d.ts +7 -0
  108. package/dist/tui/app.js +122 -0
  109. package/dist/tui/args.d.ts +8 -0
  110. package/dist/tui/args.js +57 -0
  111. package/dist/tui/capabilities/policy.d.ts +7 -0
  112. package/dist/tui/capabilities/policy.js +64 -0
  113. package/dist/tui/components/frame.d.ts +8 -0
  114. package/dist/tui/components/frame.js +8 -0
  115. package/dist/tui/components/status-bar.d.ts +8 -0
  116. package/dist/tui/components/status-bar.js +8 -0
  117. package/dist/tui/index.d.ts +2 -0
  118. package/dist/tui/index.js +23 -0
  119. package/dist/tui/index.mjs +7563 -0
  120. package/dist/tui/keymap/use-global-keymap.d.ts +19 -0
  121. package/dist/tui/keymap/use-global-keymap.js +82 -0
  122. package/dist/tui/navigation/nav-items.d.ts +3 -0
  123. package/dist/tui/navigation/nav-items.js +18 -0
  124. package/dist/tui/screens/bridge.d.ts +8 -0
  125. package/dist/tui/screens/bridge.js +19 -0
  126. package/dist/tui/screens/decisions.d.ts +5 -0
  127. package/dist/tui/screens/decisions.js +28 -0
  128. package/dist/tui/screens/export.d.ts +5 -0
  129. package/dist/tui/screens/export.js +16 -0
  130. package/dist/tui/screens/home.d.ts +5 -0
  131. package/dist/tui/screens/home.js +33 -0
  132. package/dist/tui/screens/locked.d.ts +5 -0
  133. package/dist/tui/screens/locked.js +9 -0
  134. package/dist/tui/screens/specs.d.ts +5 -0
  135. package/dist/tui/screens/specs.js +31 -0
  136. package/dist/tui/services/client.d.ts +1 -0
  137. package/dist/tui/services/client.js +18 -0
  138. package/dist/tui/services/context-service.d.ts +19 -0
  139. package/dist/tui/services/context-service.js +246 -0
  140. package/dist/tui/shared-enums.d.ts +16 -0
  141. package/dist/tui/shared-enums.js +19 -0
  142. package/dist/tui/state/use-app-state.d.ts +35 -0
  143. package/dist/tui/state/use-app-state.js +177 -0
  144. package/dist/tui/types.d.ts +77 -0
  145. package/dist/tui/types.js +2 -0
  146. package/dist/tui-bundle.d.ts +1 -0
  147. package/dist/tui-bundle.js +5 -0
  148. package/dist/tui-entry.mjs +1407 -0
  149. package/dist/utils/cli-runtime.d.ts +5 -0
  150. package/dist/utils/cli-runtime.js +22 -0
  151. package/dist/utils/help-error.d.ts +7 -0
  152. package/dist/utils/help-error.js +14 -0
  153. package/dist/utils/interaction.d.ts +19 -0
  154. package/dist/utils/interaction.js +93 -0
  155. package/dist/utils/structured-log.d.ts +7 -0
  156. package/dist/utils/structured-log.js +112 -0
  157. package/dist/utils/trpc-url.d.ts +4 -0
  158. package/dist/utils/trpc-url.js +15 -0
  159. package/package.json +59 -0
@@ -0,0 +1,219 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * spec-frontmatter CLI Tool
5
+ *
6
+ * Parse and validate YAML frontmatter from a specification file.
7
+ *
8
+ * Usage: spekn spec frontmatter <spec-file-path> [OPTIONS]
9
+ * Example: spekn spec frontmatter specs/SPECIFICATION.md
10
+ */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || (function () {
28
+ var ownKeys = function(o) {
29
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30
+ var ar = [];
31
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
+ return ar;
33
+ };
34
+ return ownKeys(o);
35
+ };
36
+ return function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ })();
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.main = main;
46
+ const fs = __importStar(require("fs"));
47
+ const path = __importStar(require("path"));
48
+ const shared_1 = require("@spekn/shared");
49
+ const cli_runtime_1 = require("./utils/cli-runtime");
50
+ function parseArgs(args) {
51
+ const options = {};
52
+ let filePath;
53
+ for (let i = 0; i < args.length; i++) {
54
+ const arg = args[i];
55
+ if (arg === "--verbose" || arg === "-v") {
56
+ options.verbose = true;
57
+ }
58
+ else if (arg === "--json" || arg === "-j") {
59
+ options.json = true;
60
+ }
61
+ else if (arg === "--validate-only") {
62
+ options.validateOnly = true;
63
+ }
64
+ else if (arg === "--auto-generate") {
65
+ options.autoGenerate = true;
66
+ }
67
+ else if (!arg.startsWith("-")) {
68
+ filePath = arg;
69
+ }
70
+ }
71
+ if (!filePath) {
72
+ throw new Error("missing required argument: <spec-file-path>");
73
+ }
74
+ return { filePath, options };
75
+ }
76
+ function printHelp() {
77
+ console.log(`
78
+ spec-frontmatter - Parse and validate specification frontmatter
79
+
80
+ USAGE:
81
+ spekn spec frontmatter <spec-file-path> [OPTIONS]
82
+
83
+ ARGUMENTS:
84
+ <spec-file-path> Path to the specification markdown file
85
+
86
+ OPTIONS:
87
+ -v, --verbose Show detailed output including all fields
88
+ -j, --json Output in JSON format
89
+ --validate-only Only validate, don't display parsed result
90
+ --auto-generate Generate minimal frontmatter if missing
91
+ -h, --help Show this help message
92
+
93
+ EXAMPLES:
94
+ spekn spec frontmatter specs/SPECIFICATION.md
95
+ spekn spec frontmatter specs/SPECIFICATION.md --json
96
+ spekn spec frontmatter specs/SPECIFICATION.md --validate-only
97
+ spekn spec frontmatter specs/SPECIFICATION.md --auto-generate
98
+ `);
99
+ }
100
+ function main(argv) {
101
+ const args = argv ?? process.argv.slice(2);
102
+ if ((0, cli_runtime_1.hasHelpFlag)(args)) {
103
+ printHelp();
104
+ return 0;
105
+ }
106
+ let filePath;
107
+ let options;
108
+ try {
109
+ ({ filePath, options } = parseArgs(args));
110
+ }
111
+ catch {
112
+ console.error("Error: Missing required argument <spec-file-path>");
113
+ printHelp();
114
+ return 1;
115
+ }
116
+ const resolvedPath = path.resolve(process.cwd(), filePath);
117
+ if (!fs.existsSync(resolvedPath)) {
118
+ console.error(`Error: File not found: ${resolvedPath}`);
119
+ return 1;
120
+ }
121
+ let content;
122
+ try {
123
+ content = fs.readFileSync(resolvedPath, "utf-8");
124
+ }
125
+ catch (error) {
126
+ console.error(`Error reading file: ${(0, cli_runtime_1.errorMessage)(error)}`);
127
+ return 1;
128
+ }
129
+ const result = (0, shared_1.parseSpecificationFrontmatter)(content);
130
+ // Auto-generate if requested and no frontmatter found
131
+ if (!result.hasFrontmatter && options.autoGenerate) {
132
+ const generated = (0, shared_1.autoGenerateFrontmatter)(content);
133
+ const yamlStr = (0, shared_1.serializeFrontmatter)(generated);
134
+ if (options.json) {
135
+ console.log(JSON.stringify({ frontmatter: generated, autoGenerated: true }, null, 2));
136
+ }
137
+ else {
138
+ console.log("\nNo frontmatter found. Auto-generated minimal frontmatter:\n");
139
+ console.log(yamlStr);
140
+ console.log();
141
+ }
142
+ return 0;
143
+ }
144
+ // Handle validation errors
145
+ if (result.errors?.length) {
146
+ if (options.json) {
147
+ console.log(JSON.stringify({ errors: result.errors, valid: false }, null, 2));
148
+ }
149
+ else {
150
+ console.error(`\nFrontmatter validation failed for ${path.basename(filePath)}:\n`);
151
+ for (const error of result.errors) {
152
+ console.error(` - ${error}`);
153
+ }
154
+ console.error();
155
+ }
156
+ return 1;
157
+ }
158
+ // No frontmatter found
159
+ if (!result.hasFrontmatter) {
160
+ if (options.json) {
161
+ console.log(JSON.stringify({ hasFrontmatter: false, valid: false }, null, 2));
162
+ }
163
+ else {
164
+ console.error(`\nError: No frontmatter found in ${path.basename(filePath)}`);
165
+ console.error(" Specifications require YAML frontmatter delimited by --- markers.");
166
+ console.error(" Use --auto-generate to create minimal frontmatter.\n");
167
+ }
168
+ return 1;
169
+ }
170
+ // Validate-only mode
171
+ if (options.validateOnly) {
172
+ if (options.json) {
173
+ console.log(JSON.stringify({ valid: true }, null, 2));
174
+ }
175
+ else {
176
+ console.log(`\nFrontmatter valid in ${path.basename(filePath)}\n`);
177
+ }
178
+ return 0;
179
+ }
180
+ // Display parsed frontmatter
181
+ if (options.json) {
182
+ console.log(JSON.stringify(result, null, 2));
183
+ }
184
+ else {
185
+ const fm = result.frontmatter;
186
+ console.log(`\nFrontmatter for ${path.basename(filePath)}:\n`);
187
+ console.log(` Title: ${fm.title}`);
188
+ console.log(` Type: ${fm.type}`);
189
+ console.log(` Version: ${fm.version}`);
190
+ if (fm.status)
191
+ console.log(` Status: ${fm.status}`);
192
+ if (fm.author)
193
+ console.log(` Author: ${fm.author}`);
194
+ if (fm.specRef)
195
+ console.log(` SpecRef: ${fm.specRef}`);
196
+ if (fm.tags?.length)
197
+ console.log(` Tags: ${fm.tags.join(", ")}`);
198
+ if (fm.hints && options.verbose) {
199
+ console.log("\n Content Hints:");
200
+ for (const [layer, hints] of Object.entries(fm.hints)) {
201
+ if (hints?.length) {
202
+ console.log(` ${layer}:`);
203
+ for (const hint of hints) {
204
+ console.log(` - ${hint}`);
205
+ }
206
+ }
207
+ }
208
+ }
209
+ if (fm.dependsOn?.length)
210
+ console.log(`\n Dependencies: ${fm.dependsOn.join(", ")}`);
211
+ if (fm.extends)
212
+ console.log(` Extends: ${fm.extends}`);
213
+ console.log();
214
+ }
215
+ return 0;
216
+ }
217
+ if (require.main === module) {
218
+ void (0, cli_runtime_1.runCliMain)(main, { errorPrefix: "spec-frontmatter failed" });
219
+ }
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * spec-lint CLI Tool
4
+ *
5
+ * Validate specification markdown quality and structure.
6
+ *
7
+ * Usage: npm run spec-lint <spec-file-path>
8
+ * Example: npm run spec-lint specs/DECISIONS.md
9
+ */
10
+ declare function main(argv?: string[]): number;
11
+ export { main };