@spekn/cli 1.0.0 → 1.0.2

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 (154) hide show
  1. package/README.md +58 -0
  2. package/dist/main.js +40540 -32176
  3. package/dist/prompts/governance-analysis.prompt.md +109 -0
  4. package/dist/resources/prompts/repo-analysis.prompt.md +28 -136
  5. package/dist/resources/prompts/repo-sync-analysis.prompt.md +31 -68
  6. package/dist/tui/chunk-4WEASLXY.mjs +3444 -0
  7. package/dist/tui/chunk-755CADEG.mjs +3401 -0
  8. package/dist/tui/chunk-BUJQVTY5.mjs +3409 -0
  9. package/dist/tui/chunk-BZKKMGFB.mjs +1959 -0
  10. package/dist/tui/chunk-DJYOBCNM.mjs +3159 -0
  11. package/dist/tui/chunk-GTFTFDY4.mjs +3417 -0
  12. package/dist/tui/chunk-IMEBD2KA.mjs +3444 -0
  13. package/dist/tui/chunk-IX6DR5SW.mjs +3433 -0
  14. package/dist/tui/chunk-JKFOY4IF.mjs +2003 -0
  15. package/dist/tui/chunk-OXXZ3O5L.mjs +3378 -0
  16. package/dist/tui/chunk-SHJNIAAJ.mjs +1697 -0
  17. package/dist/tui/chunk-V4SNDRUS.mjs +1666 -0
  18. package/dist/tui/chunk-VXVHNZST.mjs +1666 -0
  19. package/dist/tui/chunk-WCTSFKTA.mjs +3459 -0
  20. package/dist/tui/chunk-X2XP5ACW.mjs +3443 -0
  21. package/dist/tui/chunk-YUYJ7VBG.mjs +2029 -0
  22. package/dist/tui/chunk-ZM3EI5IA.mjs +3384 -0
  23. package/dist/tui/chunk-ZYOX64HP.mjs +1653 -0
  24. package/dist/tui/index.mjs +6999 -6938
  25. package/dist/tui/prompts/spec-creation-system.prompt.md +47 -0
  26. package/dist/tui/prompts/spec-refinement-system.prompt.md +72 -0
  27. package/dist/tui/use-session-store-63YUGUFA.mjs +8 -0
  28. package/dist/tui/use-session-store-ACO2SMJC.mjs +8 -0
  29. package/dist/tui/use-session-store-BVFDAWOB.mjs +8 -0
  30. package/dist/tui/use-session-store-DJIZ3FQZ.mjs +9 -0
  31. package/dist/tui/use-session-store-EAIQA4UG.mjs +9 -0
  32. package/dist/tui/use-session-store-EFBAXC3G.mjs +8 -0
  33. package/dist/tui/use-session-store-FJOR4KTG.mjs +8 -0
  34. package/dist/tui/use-session-store-IJE5KVOC.mjs +8 -0
  35. package/dist/tui/use-session-store-KGAFXCKI.mjs +8 -0
  36. package/dist/tui/use-session-store-KS4DPNDY.mjs +8 -0
  37. package/dist/tui/use-session-store-MMHJENNL.mjs +8 -0
  38. package/dist/tui/use-session-store-OZ6HC4I2.mjs +9 -0
  39. package/dist/tui/use-session-store-PTMWISNJ.mjs +8 -0
  40. package/dist/tui/use-session-store-VCDECQMW.mjs +8 -0
  41. package/dist/tui/use-session-store-VOK5ML5J.mjs +9 -0
  42. package/package.json +33 -13
  43. package/dist/__tests__/export-cli.test.d.ts +0 -1
  44. package/dist/__tests__/export-cli.test.js +0 -70
  45. package/dist/__tests__/tui-args-policy.test.d.ts +0 -1
  46. package/dist/__tests__/tui-args-policy.test.js +0 -50
  47. package/dist/acp-S2MHZOAD.mjs +0 -23
  48. package/dist/acp-UCCI44JY.mjs +0 -25
  49. package/dist/auth/credentials-store.d.ts +0 -2
  50. package/dist/auth/credentials-store.js +0 -5
  51. package/dist/auth/device-flow.d.ts +0 -36
  52. package/dist/auth/device-flow.js +0 -189
  53. package/dist/auth/jwt.d.ts +0 -1
  54. package/dist/auth/jwt.js +0 -6
  55. package/dist/auth/session.d.ts +0 -67
  56. package/dist/auth/session.js +0 -86
  57. package/dist/auth-login.d.ts +0 -34
  58. package/dist/auth-login.js +0 -202
  59. package/dist/auth-logout.d.ts +0 -25
  60. package/dist/auth-logout.js +0 -115
  61. package/dist/auth-status.d.ts +0 -24
  62. package/dist/auth-status.js +0 -109
  63. package/dist/backlog-generate.d.ts +0 -11
  64. package/dist/backlog-generate.js +0 -308
  65. package/dist/backlog-health.d.ts +0 -11
  66. package/dist/backlog-health.js +0 -287
  67. package/dist/bridge-login.d.ts +0 -40
  68. package/dist/bridge-login.js +0 -277
  69. package/dist/chunk-3PAYRI4G.mjs +0 -2428
  70. package/dist/chunk-M4CS3A25.mjs +0 -2426
  71. package/dist/commands/auth/login.d.ts +0 -30
  72. package/dist/commands/auth/login.js +0 -164
  73. package/dist/commands/auth/logout.d.ts +0 -25
  74. package/dist/commands/auth/logout.js +0 -115
  75. package/dist/commands/auth/status.d.ts +0 -24
  76. package/dist/commands/auth/status.js +0 -109
  77. package/dist/commands/backlog/generate.d.ts +0 -11
  78. package/dist/commands/backlog/generate.js +0 -308
  79. package/dist/commands/backlog/health.d.ts +0 -11
  80. package/dist/commands/backlog/health.js +0 -287
  81. package/dist/commands/bridge/login.d.ts +0 -36
  82. package/dist/commands/bridge/login.js +0 -258
  83. package/dist/commands/export.d.ts +0 -35
  84. package/dist/commands/export.js +0 -485
  85. package/dist/commands/marketplace-export.d.ts +0 -21
  86. package/dist/commands/marketplace-export.js +0 -214
  87. package/dist/commands/project-clean.d.ts +0 -1
  88. package/dist/commands/project-clean.js +0 -126
  89. package/dist/commands/repo/common.d.ts +0 -105
  90. package/dist/commands/repo/common.js +0 -775
  91. package/dist/commands/repo/detach.d.ts +0 -2
  92. package/dist/commands/repo/detach.js +0 -120
  93. package/dist/commands/repo/register.d.ts +0 -21
  94. package/dist/commands/repo/register.js +0 -175
  95. package/dist/commands/repo/sync.d.ts +0 -22
  96. package/dist/commands/repo/sync.js +0 -873
  97. package/dist/commands/skills-import-local.d.ts +0 -16
  98. package/dist/commands/skills-import-local.js +0 -352
  99. package/dist/commands/spec/drift-check.d.ts +0 -3
  100. package/dist/commands/spec/drift-check.js +0 -186
  101. package/dist/commands/spec/frontmatter.d.ts +0 -11
  102. package/dist/commands/spec/frontmatter.js +0 -219
  103. package/dist/commands/spec/lint.d.ts +0 -11
  104. package/dist/commands/spec/lint.js +0 -499
  105. package/dist/commands/spec/parse.d.ts +0 -11
  106. package/dist/commands/spec/parse.js +0 -162
  107. package/dist/export.d.ts +0 -35
  108. package/dist/export.js +0 -485
  109. package/dist/main.d.ts +0 -1
  110. package/dist/marketplace-export.d.ts +0 -21
  111. package/dist/marketplace-export.js +0 -214
  112. package/dist/project-clean.d.ts +0 -1
  113. package/dist/project-clean.js +0 -126
  114. package/dist/project-context.d.ts +0 -99
  115. package/dist/project-context.js +0 -376
  116. package/dist/repo-common.d.ts +0 -101
  117. package/dist/repo-common.js +0 -671
  118. package/dist/repo-detach.d.ts +0 -2
  119. package/dist/repo-detach.js +0 -102
  120. package/dist/repo-ingest.d.ts +0 -29
  121. package/dist/repo-ingest.js +0 -305
  122. package/dist/repo-register.d.ts +0 -21
  123. package/dist/repo-register.js +0 -175
  124. package/dist/repo-sync.d.ts +0 -16
  125. package/dist/repo-sync.js +0 -152
  126. package/dist/resources/prompt-loader.d.ts +0 -1
  127. package/dist/resources/prompt-loader.js +0 -62
  128. package/dist/skills-import-local.d.ts +0 -16
  129. package/dist/skills-import-local.js +0 -352
  130. package/dist/spec-drift-check.d.ts +0 -3
  131. package/dist/spec-drift-check.js +0 -186
  132. package/dist/spec-frontmatter.d.ts +0 -11
  133. package/dist/spec-frontmatter.js +0 -219
  134. package/dist/spec-lint.d.ts +0 -11
  135. package/dist/spec-lint.js +0 -499
  136. package/dist/spec-parse.d.ts +0 -11
  137. package/dist/spec-parse.js +0 -162
  138. package/dist/stubs/dotenv.d.ts +0 -5
  139. package/dist/stubs/dotenv.js +0 -6
  140. package/dist/stubs/typeorm.d.ts +0 -22
  141. package/dist/stubs/typeorm.js +0 -28
  142. package/dist/tui-bundle.d.ts +0 -1
  143. package/dist/tui-bundle.js +0 -5
  144. package/dist/tui-entry.mjs +0 -1407
  145. package/dist/utils/cli-runtime.d.ts +0 -5
  146. package/dist/utils/cli-runtime.js +0 -22
  147. package/dist/utils/help-error.d.ts +0 -7
  148. package/dist/utils/help-error.js +0 -14
  149. package/dist/utils/interaction.d.ts +0 -19
  150. package/dist/utils/interaction.js +0 -93
  151. package/dist/utils/structured-log.d.ts +0 -7
  152. package/dist/utils/structured-log.js +0 -112
  153. package/dist/utils/trpc-url.d.ts +0 -4
  154. package/dist/utils/trpc-url.js +0 -15
@@ -0,0 +1,47 @@
1
+ You are a specification creation assistant for Spekn (Spec-Driven Development).
2
+
3
+ ## Communication Style
4
+
5
+ You are running inside a terminal UI (TUI). You do NOT have WebMCP or browser tools.
6
+ Communicate with the user through:
7
+ - **Interactive prompts** (the bridge will send interaction_request events for selections and questions)
8
+ - **Plain text responses** that stream to the terminal
9
+
10
+ Keep responses concise — the terminal has limited width.
11
+
12
+ ## Available Context
13
+
14
+ Read these MCP resources for spec state:
15
+ - `spec://content` — Current specification content
16
+ - `spec://frontmatter` — Parsed YAML frontmatter
17
+ - `spec://health` — Quick health check (has frontmatter, anchors, hints, relationships)
18
+ - `spec://quality` — Quality score, grade, and issues
19
+ - `spec://anchors` — Anchor paths in the spec
20
+
21
+ Call these MCP prompts for detailed guidance:
22
+ - `spec-creation-workflow` — Step-by-step creation workflow
23
+ - `spec-rules` — Frontmatter schema, body structure, quality scoring rules
24
+ - `available-actions` — Available tools and when to use them
25
+
26
+ ## High-Level Workflow
27
+
28
+ 1. Analyze the user's request (1-2 sentences)
29
+ 2. Confirm spec type (capability, architectural, workflow, operational, decision, intent)
30
+ 3. Confirm spec depth (memo, standard, full)
31
+ 4. Gather requirements — batch related questions (2-4 per interaction). Allow multiple selections where appropriate.
32
+ 5. Generate the specification with proper YAML frontmatter and markdown body. For **capability** specs, include a `capability` block with `module`, `feature`, and an `anchors` record matching body anchor headings (each with at least `status: "draft"`).
33
+ 6. Present the full specification content as your final response
34
+
35
+ Execute ALL workflow steps in a SINGLE turn when possible. After each interaction response, immediately proceed to the next step. The user should not need to type "continue".
36
+
37
+ The final specification MUST include:
38
+ - YAML frontmatter with title, type, status: draft, generation: 1, and relevant hints/relationships
39
+ - Structured markdown body with proper heading hierarchy and anchor paths (### #anchor.path)
40
+ - Acceptance criteria, constraints, and technical context sections as appropriate
41
+
42
+ Spec type hint: {{SPEC_TYPE}}
43
+ Spec depth hint: {{SPEC_DEPTH}}
44
+
45
+ ## User Request
46
+
47
+ {{USER_MESSAGE}}
@@ -0,0 +1,72 @@
1
+ You are a specification refinement assistant for Spekn (Spec-Driven Development).
2
+ Your goal is to help the user reach a quality score of 70+ (grade B or higher).
3
+
4
+ ## Communication Style
5
+
6
+ You are running inside a terminal UI (TUI). You do NOT have WebMCP or browser tools.
7
+ Communicate with the user through:
8
+ - **Interactive prompts** (the bridge will send interaction_request events for selections and questions)
9
+ - **Plain text responses** that stream to the terminal
10
+
11
+ Keep responses concise — the terminal has limited width.
12
+
13
+ ## Available Context
14
+
15
+ Read these MCP resources for spec state:
16
+ - `spec://content` — Current specification content (always read before proposing changes)
17
+ - `spec://frontmatter` — Parsed YAML frontmatter
18
+ - `spec://health` — Quick health check
19
+ - `spec://quality` — Quality score, grade, breakdown, and issues
20
+ - `spec://anchors` — Anchor paths in the spec
21
+
22
+ Call these MCP prompts for detailed guidance:
23
+ - `spec-refinement-workflow` — Step-by-step refinement workflow
24
+ - `spec-rules` — Frontmatter schema, body structure, quality scoring rules
25
+ - `available-actions` (flow=refinement) — Available tools and when to use them
26
+
27
+ ## Frontmatter Enrichment
28
+
29
+ If the spec's frontmatter is missing `hints` (constraints, requirements, technical, guidance) or `aiContext` (priorityAnchors), propose changes to populate them. Extract:
30
+ - `hints.constraints` from constraint sections and protected sections
31
+ - `hints.requirements` from acceptance criteria
32
+ - `hints.technical` from technical context sections
33
+ - `aiContext.priorityAnchors` from the most critical anchor paths (max 5)
34
+
35
+ ## Capability Block Enrichment
36
+
37
+ For **capability** specs, check whether the `capability` frontmatter block is present and complete:
38
+
39
+ 1. **Missing `capability` block**: If the spec type is `capability` but has no `capability` block, propose one with:
40
+ - `module`: inferred from the first segment of anchor paths (e.g., `auth` from `auth.login.validation`)
41
+ - `feature`: inferred from the second segment (e.g., `login`)
42
+ - `anchors`: record mapping each body anchor path to `{ status: "draft" }`
43
+
44
+ 2. **Populate rich metadata**: For each anchor in `capability.anchors`, propose adding:
45
+ - `hint`: one-sentence summary of the anchor's purpose
46
+ - `complexity`: trivial | low | medium | high | critical
47
+ - `status`: draft | ready | implemented | tested
48
+
49
+ 3. **Anchor drift**: Detect mismatches between body anchor headings, `frontmatter.anchors`, and `capability.anchors` keys. Propose fixes to bring all three in sync.
50
+
51
+ ## Critical Rules
52
+
53
+ - Start by analyzing the current spec quality and presenting key issues
54
+ - Lead with critical issues (most score impact)
55
+ - Provide EXACT before/after diffs when proposing changes
56
+ - Do NOT re-propose fixes the user has skipped
57
+ - Present the updated specification as your final response when refinement is complete
58
+
59
+ ## Current Specification
60
+
61
+ Title: {{SPEC_TITLE}}
62
+ {{QUALITY_SCORE_LINE}}
63
+
64
+ ### Issues Found:
65
+ {{ISSUES_SUMMARY}}
66
+
67
+ ### Spec Content:
68
+ ```markdown
69
+ {{SPEC_CONTENT}}
70
+ ```
71
+
72
+ Begin by analyzing the specification and presenting the key quality issues to address.
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-OXXZ3O5L.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-GTFTFDY4.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-X2XP5ACW.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-V4SNDRUS.mjs";
5
+ import "./chunk-JKFOY4IF.mjs";
6
+ export {
7
+ buildOnboardingState,
8
+ useSessionStore
9
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-VXVHNZST.mjs";
5
+ import "./chunk-BZKKMGFB.mjs";
6
+ export {
7
+ buildOnboardingState,
8
+ useSessionStore
9
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-ZM3EI5IA.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-BUJQVTY5.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-DJYOBCNM.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-4WEASLXY.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-755CADEG.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-IMEBD2KA.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-ZYOX64HP.mjs";
5
+ import "./chunk-BZKKMGFB.mjs";
6
+ export {
7
+ buildOnboardingState,
8
+ useSessionStore
9
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-WCTSFKTA.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-IX6DR5SW.mjs";
5
+ export {
6
+ buildOnboardingState,
7
+ useSessionStore
8
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ buildOnboardingState,
3
+ useSessionStore
4
+ } from "./chunk-SHJNIAAJ.mjs";
5
+ import "./chunk-YUYJ7VBG.mjs";
6
+ export {
7
+ buildOnboardingState,
8
+ useSessionStore
9
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spekn/cli",
3
- "version": "1.0.0",
4
- "description": "Spekn CLI — Spec-Driven Development toolchain",
3
+ "version": "1.0.2",
4
+ "description": "Spekn CLI — Spec-Driven Development toolchain. Installs the `spekn` command.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -9,8 +9,17 @@
9
9
  "spekn": "dist/main.js"
10
10
  },
11
11
  "files": [
12
- "dist"
12
+ "dist/main.js",
13
+ "dist/index.js",
14
+ "dist/index.d.ts",
15
+ "dist/tui/",
16
+ "dist/resources/prompts/",
17
+ "dist/prompts/",
18
+ "README.md"
13
19
  ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
14
23
  "engines": {
15
24
  "node": ">=22",
16
25
  "npm": ">=10"
@@ -20,40 +29,51 @@
20
29
  "url": "https://github.com/spekn/spekn.git",
21
30
  "directory": "packages/cli"
22
31
  },
32
+ "homepage": "https://spekn.dev",
33
+ "bugs": {
34
+ "url": "https://github.com/spekn/spekn/issues"
35
+ },
23
36
  "keywords": [
24
37
  "spekn",
25
38
  "sdd",
26
39
  "spec-driven-development",
27
40
  "cli",
28
41
  "specifications",
29
- "ai-agents"
42
+ "ai-agents",
43
+ "governance",
44
+ "context-engineering"
30
45
  ],
31
46
  "scripts": {
32
- "build": "npm -w @spekn/tui run build && tsc --build && tsup && mkdir -p dist/tui && cp ../tui/dist/index.mjs dist/tui/index.mjs && mkdir -p dist/resources/prompts && cp -R src/resources/prompts/. dist/resources/prompts/",
47
+ "build": "npm -w @spekn/check run build && npm -w @spekn/bridge run build && npm -w @spekn/tui run build && tsc --build && tsup && mkdir -p dist/tui && cp ../tui/dist/index.mjs ../tui/dist/chunk-*.mjs ../tui/dist/use-session-store-*.mjs dist/tui/ && mkdir -p dist/tui/prompts && cp ../tui/dist/prompts/*.prompt.md dist/tui/prompts/ && mkdir -p dist/resources/prompts && cp -R src/resources/prompts/. dist/resources/prompts/ && mkdir -p dist/prompts && cp -R ../check/dist/prompts/. dist/prompts/",
33
48
  "dev": "tsc --build --watch",
34
49
  "clean": "rm -rf dist",
50
+ "prepublishOnly": "npm run build",
35
51
  "project-delete": "ts-node src/commands/project-clean.ts"
36
52
  },
37
53
  "dependencies": {
38
- "@inkjs/ui": "^2.0.0",
39
- "@trpc/client": "^10.45.4",
54
+ "@openpanel/sdk": "^1.0.0",
55
+ "@spekn/analytics": "*",
40
56
  "commander": "^14.0.3",
41
- "ink": "^6.8.0",
42
57
  "js-yaml": "^4.1.0",
43
58
  "open": "^10.2.0",
44
- "pg": "^8.18.0",
45
- "react": "^19.2.0",
46
- "typeorm": "^0.3.28",
47
- "zustand": "^5.0.8",
48
59
  "zod": "^4.3.6"
49
60
  },
61
+ "optionalDependencies": {
62
+ "pg": "^8.18.0",
63
+ "typeorm": "^0.3.28"
64
+ },
50
65
  "devDependencies": {
66
+ "@inkjs/ui": "^2.0.0",
51
67
  "@spekn/agents": "*",
52
68
  "@spekn/bridge": "*",
53
69
  "@spekn/check": "*",
54
70
  "@spekn/shared": "*",
55
71
  "@spekn/tui": "*",
72
+ "@trpc/client": "^10.45.4",
73
+ "ink": "^6.8.0",
74
+ "react": "^19.2.0",
56
75
  "tsup": "^8.5.1",
57
- "typescript": "^5.9.3"
76
+ "typescript": "^5.9.3",
77
+ "zustand": "^5.0.8"
58
78
  }
59
79
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const strict_1 = __importDefault(require("node:assert/strict"));
7
- const export_1 = require("../export");
8
- function createDeps() {
9
- const state = {
10
- stdout: '',
11
- stderr: '',
12
- writes: [],
13
- };
14
- const deps = {
15
- createClient: () => ({
16
- export: {
17
- generate: {
18
- mutate: async () => ({
19
- content: 'GENERATED CONTENT\n',
20
- anchorCount: 2,
21
- }),
22
- },
23
- },
24
- }),
25
- writeFile: (filePath, content) => {
26
- state.writes.push({ path: filePath, content });
27
- },
28
- stdout: (content) => {
29
- state.stdout += content;
30
- },
31
- stderr: (content) => {
32
- state.stderr += content;
33
- },
34
- };
35
- return { state, deps };
36
- }
37
- async function testStdoutMode() {
38
- const { state, deps } = createDeps();
39
- const code = await (0, export_1.runExportCli)(['--project', '11111111-1111-4111-8111-111111111111', '--format', 'claude-md'], deps);
40
- strict_1.default.equal(code, 0);
41
- strict_1.default.equal(state.stdout, 'GENERATED CONTENT\n');
42
- strict_1.default.equal(state.writes.length, 0);
43
- }
44
- async function testOutputMode() {
45
- const { state, deps } = createDeps();
46
- const code = await (0, export_1.runExportCli)([
47
- '--project',
48
- '11111111-1111-4111-8111-111111111111',
49
- '--format',
50
- 'cursorrules',
51
- '--output',
52
- 'tmp-export.txt',
53
- ], deps);
54
- strict_1.default.equal(code, 0);
55
- strict_1.default.equal(state.writes.length, 1);
56
- strict_1.default.ok(state.stdout.includes('Exported 2 anchors'));
57
- }
58
- async function testMissingRequiredArgs() {
59
- const { state, deps } = createDeps();
60
- const code = await (0, export_1.runExportCli)(['--format', 'claude-md'], deps);
61
- strict_1.default.equal(code, 1);
62
- strict_1.default.ok(state.stderr.includes('Missing required argument'));
63
- }
64
- async function main() {
65
- await testStdoutMode();
66
- await testOutputMode();
67
- await testMissingRequiredArgs();
68
- process.stdout.write('export-cli.test.ts passed\n');
69
- }
70
- void main();
@@ -1 +0,0 @@
1
- export {};
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const strict_1 = __importDefault(require("node:assert/strict"));
7
- const shared_1 = require("@spekn/shared");
8
- const args_1 = require("../tui/args");
9
- const policy_1 = require("../tui/capabilities/policy");
10
- function testParseArgs() {
11
- const parsed = (0, args_1.parseTuiArgs)([
12
- '--project-id',
13
- '11111111-1111-4111-8111-111111111111',
14
- '--api-url',
15
- 'http://localhost:9999',
16
- '--view',
17
- 'export',
18
- '--no-color',
19
- ]);
20
- strict_1.default.equal(parsed.projectId, '11111111-1111-4111-8111-111111111111');
21
- strict_1.default.equal(parsed.apiUrl, 'http://localhost:9999');
22
- strict_1.default.equal(parsed.initialView, 'export');
23
- strict_1.default.equal(parsed.noColor, true);
24
- }
25
- function testTierLocks() {
26
- const freePolicy = (0, policy_1.resolveNavPolicy)({
27
- plan: shared_1.OrganizationPlan.FREE,
28
- role: 'member',
29
- workflowPhase: null,
30
- permissions: [],
31
- });
32
- const bridge = freePolicy.find((item) => item.id === 'bridge');
33
- const teamFeature = freePolicy.find((item) => item.id === 'active-runs');
34
- strict_1.default.equal(bridge?.state, 'locked');
35
- strict_1.default.equal(teamFeature?.state, 'locked');
36
- const teamPolicy = (0, policy_1.resolveNavPolicy)({
37
- plan: shared_1.OrganizationPlan.TEAM,
38
- role: 'viewer',
39
- workflowPhase: 'plan',
40
- permissions: [],
41
- });
42
- const gates = teamPolicy.find((item) => item.id === 'phase-gates');
43
- strict_1.default.equal(gates?.state, 'disabled');
44
- }
45
- function main() {
46
- testParseArgs();
47
- testTierLocks();
48
- process.stdout.write('tui-args-policy.test.ts passed\n');
49
- }
50
- main();
@@ -1,23 +0,0 @@
1
- // Bundled TUI entry (ESM) — loaded via dynamic import() from CJS main.js
2
- import {
3
- AGENT_METHODS,
4
- AgentSideConnection,
5
- CLIENT_METHODS,
6
- ClientSideConnection,
7
- PROTOCOL_VERSION,
8
- RequestError,
9
- TerminalHandle,
10
- init_acp,
11
- ndJsonStream
12
- } from "./chunk-M4CS3A25.mjs";
13
- init_acp();
14
- export {
15
- AGENT_METHODS,
16
- AgentSideConnection,
17
- CLIENT_METHODS,
18
- ClientSideConnection,
19
- PROTOCOL_VERSION,
20
- RequestError,
21
- TerminalHandle,
22
- ndJsonStream
23
- };
@@ -1,25 +0,0 @@
1
- // Bundled TUI entry (ESM) — loaded via dynamic import() from CJS main.js
2
- import { createRequire as __createRequire } from 'module';
3
- const require = __createRequire(import.meta.url);
4
- import {
5
- AGENT_METHODS,
6
- AgentSideConnection,
7
- CLIENT_METHODS,
8
- ClientSideConnection,
9
- PROTOCOL_VERSION,
10
- RequestError,
11
- TerminalHandle,
12
- init_acp,
13
- ndJsonStream
14
- } from "./chunk-3PAYRI4G.mjs";
15
- init_acp();
16
- export {
17
- AGENT_METHODS,
18
- AgentSideConnection,
19
- CLIENT_METHODS,
20
- ClientSideConnection,
21
- PROTOCOL_VERSION,
22
- RequestError,
23
- TerminalHandle,
24
- ndJsonStream
25
- };
@@ -1,2 +0,0 @@
1
- export { CredentialsStore } from "@spekn/shared";
2
- export type { CliCredentials } from "@spekn/shared";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CredentialsStore = void 0;
4
- var shared_1 = require("@spekn/shared");
5
- Object.defineProperty(exports, "CredentialsStore", { enumerable: true, get: function () { return shared_1.CredentialsStore; } });
@@ -1,36 +0,0 @@
1
- /**
2
- * RFC 8628 Device Authorization Grant (Device Flow)
3
- *
4
- * Implements the OAuth 2.0 Device Authorization Grant for CLI authentication
5
- * against a Keycloak realm.
6
- *
7
- * @see https://www.rfc-editor.org/rfc/rfc8628
8
- */
9
- export interface DeviceFlowResult {
10
- accessToken: string;
11
- refreshToken: string;
12
- expiresIn: number;
13
- idToken?: string;
14
- }
15
- export interface DeviceFlowDeps {
16
- stdout: {
17
- write(s: string): void;
18
- };
19
- stderr: {
20
- write(s: string): void;
21
- };
22
- openBrowser: (url: string) => Promise<void>;
23
- }
24
- /** Default browser opener — dynamically imports the `open` package. */
25
- declare const defaultOpenBrowser: (url: string) => Promise<void>;
26
- /**
27
- * Perform the RFC 8628 Device Authorization Grant against a Keycloak realm.
28
- *
29
- * @param keycloakUrl - Base Keycloak URL, e.g. `https://auth.example.com`
30
- * @param realm - Keycloak realm name
31
- * @param clientId - OAuth2 client ID (must be a public client)
32
- * @param deps - Optional dependency overrides for testing / custom I/O
33
- * @returns Resolved tokens once the user authorises the device
34
- */
35
- export declare function performDeviceFlow(keycloakUrl: string, realm: string, clientId: string, deps?: Partial<DeviceFlowDeps>): Promise<DeviceFlowResult>;
36
- export { defaultOpenBrowser };