@jeancodogno/specforce-kit 0.1.4 → 0.1.6

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 (151) hide show
  1. package/index.js +0 -0
  2. package/package.json +12 -28
  3. package/.geminiignore +0 -15
  4. package/.github/workflows/ci.yml +0 -101
  5. package/.github/workflows/release.yml +0 -51
  6. package/.golangci.yml +0 -17
  7. package/.goreleaser.yaml +0 -39
  8. package/.rgignore +0 -13
  9. package/.specforce/config.yaml +0 -32
  10. package/.specforce/docs/.gitkeep +0 -0
  11. package/.specforce/docs/architecture.md +0 -98
  12. package/.specforce/docs/engineering.md +0 -80
  13. package/.specforce/docs/governance.md +0 -30
  14. package/.specforce/docs/memorial.md +0 -44
  15. package/.specforce/docs/principles.md +0 -31
  16. package/.specforce/docs/security.md +0 -31
  17. package/.specforce/docs/ui-ux.md +0 -129
  18. package/.specforce/specs/.gitkeep +0 -0
  19. package/AGENTS.md +0 -36
  20. package/CONTRIBUTING.md +0 -81
  21. package/Makefile +0 -49
  22. package/assets/logo-header.png +0 -0
  23. package/assets/logo.png +0 -0
  24. package/docs/artifacts.md +0 -41
  25. package/docs/cli.md +0 -73
  26. package/docs/configuration.md +0 -50
  27. package/docs/getting-started.md +0 -110
  28. package/docs/supported-tools.md +0 -14
  29. package/go.mod +0 -35
  30. package/go.sum +0 -61
  31. package/src/cmd/specforce/main.go +0 -23
  32. package/src/cmd/specforce/main_test.go +0 -7
  33. package/src/internal/agent/artifacts/constitution/architecture.yaml +0 -70
  34. package/src/internal/agent/artifacts/constitution/engineering.yaml +0 -52
  35. package/src/internal/agent/artifacts/constitution/governance.yaml +0 -41
  36. package/src/internal/agent/artifacts/constitution/memorial.yaml +0 -55
  37. package/src/internal/agent/artifacts/constitution/principles.yaml +0 -54
  38. package/src/internal/agent/artifacts/constitution/security.yaml +0 -47
  39. package/src/internal/agent/artifacts/constitution/ui-ux.yaml +0 -158
  40. package/src/internal/agent/artifacts/spec/design.yaml +0 -50
  41. package/src/internal/agent/artifacts/spec/requirements.yaml +0 -48
  42. package/src/internal/agent/artifacts/spec/tasks.yaml +0 -55
  43. package/src/internal/agent/compatibility_test.go +0 -120
  44. package/src/internal/agent/cwd_test.go +0 -9
  45. package/src/internal/agent/embed.go +0 -19
  46. package/src/internal/agent/integration_test.go +0 -138
  47. package/src/internal/agent/kit/agents/product-analyst.yaml +0 -31
  48. package/src/internal/agent/kit/agents/technical-developer.yaml +0 -28
  49. package/src/internal/agent/kit/agents/technical-project-planner.yaml +0 -30
  50. package/src/internal/agent/kit/agents/technical-qa-engineer.yaml +0 -36
  51. package/src/internal/agent/kit/agents/technical-solution-architect.yaml +0 -32
  52. package/src/internal/agent/kit/commands/archive.yaml +0 -25
  53. package/src/internal/agent/kit/commands/constitution.yaml +0 -132
  54. package/src/internal/agent/kit/commands/implement.yaml +0 -96
  55. package/src/internal/agent/kit/commands/spec.yaml +0 -94
  56. package/src/internal/agent/kit/instructions/archive.md +0 -68
  57. package/src/internal/agent/kit/kit.yaml +0 -111
  58. package/src/internal/agent/kit/skills/opportunity-framing/SKILL.yaml +0 -56
  59. package/src/internal/agent/kit/skills/pragmatic-product-owner/SKILL.yaml +0 -58
  60. package/src/internal/agent/kit/skills/pragmatic-product-owner/references/spec-artifacts.yaml +0 -38
  61. package/src/internal/agent/kit/skills/spec-clarification-interview/SKILL.yaml +0 -52
  62. package/src/internal/agent/kit/skills/task-atomic-decomposition/SKILL.yaml +0 -137
  63. package/src/internal/agent/kit/skills/task-atomic-decomposition/references/roadmap-patterns.yaml +0 -103
  64. package/src/internal/agent/kit_manifests_test.go +0 -58
  65. package/src/internal/agent/manifest.go +0 -15
  66. package/src/internal/agent/registry.go +0 -69
  67. package/src/internal/agent/registry_test.go +0 -51
  68. package/src/internal/agent/translator.go +0 -334
  69. package/src/internal/agent/translator_test.go +0 -734
  70. package/src/internal/cli/archive.go +0 -91
  71. package/src/internal/cli/archive_test.go +0 -67
  72. package/src/internal/cli/cli.go +0 -259
  73. package/src/internal/cli/cli_test.go +0 -130
  74. package/src/internal/cli/cobra/archive.go +0 -26
  75. package/src/internal/cli/cobra/console.go +0 -21
  76. package/src/internal/cli/cobra/constitution.go +0 -44
  77. package/src/internal/cli/cobra/dummy_test.go +0 -7
  78. package/src/internal/cli/cobra/implementation.go +0 -50
  79. package/src/internal/cli/cobra/init.go +0 -23
  80. package/src/internal/cli/cobra/install.go +0 -21
  81. package/src/internal/cli/cobra/root.go +0 -47
  82. package/src/internal/cli/cobra/spec.go +0 -91
  83. package/src/internal/cli/console.go +0 -48
  84. package/src/internal/cli/constitution.go +0 -190
  85. package/src/internal/cli/constitution_test.go +0 -50
  86. package/src/internal/cli/implementation.go +0 -153
  87. package/src/internal/cli/implementation_test.go +0 -165
  88. package/src/internal/cli/spec.go +0 -369
  89. package/src/internal/cli/spec_test.go +0 -85
  90. package/src/internal/constitution/registry.go +0 -139
  91. package/src/internal/constitution/registry_test.go +0 -97
  92. package/src/internal/constitution/status.go +0 -70
  93. package/src/internal/constitution/status_test.go +0 -160
  94. package/src/internal/core/blueprint.go +0 -49
  95. package/src/internal/core/blueprint_test.go +0 -58
  96. package/src/internal/core/config.go +0 -124
  97. package/src/internal/core/config_test.go +0 -145
  98. package/src/internal/core/constants.go +0 -13
  99. package/src/internal/core/errors.go +0 -31
  100. package/src/internal/core/errors_test.go +0 -48
  101. package/src/internal/core/hooks.go +0 -89
  102. package/src/internal/core/hooks_test.go +0 -51
  103. package/src/internal/core/kit.go +0 -15
  104. package/src/internal/core/kit_test.go +0 -65
  105. package/src/internal/core/path.go +0 -115
  106. package/src/internal/core/path_test.go +0 -101
  107. package/src/internal/core/ui.go +0 -19
  108. package/src/internal/installer/dependencies.go +0 -23
  109. package/src/internal/installer/install.go +0 -89
  110. package/src/internal/installer/installer.go +0 -45
  111. package/src/internal/installer/installer_test.go +0 -96
  112. package/src/internal/project/agents_md.go +0 -108
  113. package/src/internal/project/agents_md_test.go +0 -101
  114. package/src/internal/project/bootstrapper.go +0 -64
  115. package/src/internal/project/bootstrapper_test.go +0 -89
  116. package/src/internal/project/detector.go +0 -35
  117. package/src/internal/project/detector_test.go +0 -96
  118. package/src/internal/project/refresh_integration_test.go +0 -86
  119. package/src/internal/project/service.go +0 -93
  120. package/src/internal/project/service_test.go +0 -135
  121. package/src/internal/spec/archive.go +0 -49
  122. package/src/internal/spec/archive_test.go +0 -55
  123. package/src/internal/spec/discovery.go +0 -53
  124. package/src/internal/spec/discovery_test.go +0 -60
  125. package/src/internal/spec/implementation.go +0 -296
  126. package/src/internal/spec/implementation_test.go +0 -253
  127. package/src/internal/spec/registry.go +0 -142
  128. package/src/internal/spec/registry_test.go +0 -105
  129. package/src/internal/spec/scanner.go +0 -219
  130. package/src/internal/spec/scanner_test.go +0 -243
  131. package/src/internal/spec/service.go +0 -157
  132. package/src/internal/spec/service_test.go +0 -238
  133. package/src/internal/spec/status.go +0 -94
  134. package/src/internal/spec/status_test.go +0 -146
  135. package/src/internal/spec/tasks.go +0 -103
  136. package/src/internal/spec/tasks_test.go +0 -137
  137. package/src/internal/tui/components.go +0 -132
  138. package/src/internal/tui/console.go +0 -247
  139. package/src/internal/tui/console_test.go +0 -19
  140. package/src/internal/tui/constitution.go +0 -36
  141. package/src/internal/tui/constitution_test.go +0 -32
  142. package/src/internal/tui/implementation.go +0 -151
  143. package/src/internal/tui/logo.go +0 -89
  144. package/src/internal/tui/multiselect.go +0 -199
  145. package/src/internal/tui/progressbar.go +0 -37
  146. package/src/internal/tui/progressbar_test.go +0 -30
  147. package/src/internal/tui/spec.go +0 -35
  148. package/src/internal/tui/spinner.go +0 -66
  149. package/src/internal/tui/terminal.go +0 -18
  150. package/src/internal/tui/theme.go +0 -125
  151. package/src/internal/tui/ui.go +0 -52
@@ -1,48 +0,0 @@
1
- description: "Functional requirements, business rules, and strict BDD acceptance criteria."
2
- instruction: |
3
- Generate a high-fidelity business specification focusing entirely on the "What" and "Why", never the "How". Adhere strictly to the following execution rules:
4
-
5
- 1. **Zero Code Mandate:** DO NOT write technical implementation details, JSON payloads, or database schemas. Stick to pure business domain and user value.
6
- 2. **BDD Rigor:** Acceptance Criteria MUST follow the strict GIVEN/WHEN/THEN syntax. For every requirement, you MUST define at least one "Edge Case" or failure state.
7
- 3. **Scope Containment:** Pay heavy attention to the "Out of Scope" section. Explicitly list features or edge cases that downstream agents MUST NOT build.
8
- 4. **Conditional Omission:** If the `lens` is "Backend-heavy" or "Integration", you MUST completely delete the `## 5. UI/UX Contract` section. Do not leave placeholders or write "Not applicable".
9
- 5. **YAML Frontmatter:** Ensure the top YAML block is correctly populated with the `slug` and the correct `lens`.
10
- template: |
11
- ---
12
- slug: {FEATURE_SLUG}
13
- lens: [UI-heavy | Backend-heavy | Integration | Migration | Balanced full-stack]
14
- ---
15
-
16
- # Feature: {FEATURE_NAME}
17
-
18
- ## 1. Context & Value
19
- [Briefly describe the business value and the core problem being solved. Max 3 sentences.]
20
-
21
- ## 2. Out of Scope (Anti-Goals)
22
- *Explicitly state what MUST NOT be built in this specific feature to prevent scope creep.*
23
- - [e.g., Do not implement the email notification flow in this spec]
24
- - [e.g., Do not build the admin panel UI yet]
25
-
26
- ## 3. Acceptance Criteria (BDD)
27
- *Every requirement MUST be testable. Define success and failure.*
28
-
29
- ### [REQ-1] {Title}
30
- **User Story:** AS A [persona], I WANT TO [action], SO THAT [value].
31
-
32
- **Scenarios:**
33
- 1. **[Happy Path]** GIVEN [context] WHEN [action] THEN [outcome].
34
- 2. **[Edge Case]** GIVEN [context] WHEN [exception/error] THEN [fallback/behavior].
35
- 3. **[Ambiguity]** [Explicitly state what is unclear, or define the ASSUMPTION made].
36
-
37
- ### [REQ-2] {Title}
38
- *(Repeat structure as needed)*
39
-
40
- ## 4. Business Invariants
41
- *Strict domain rules that the system must never violate, regardless of the user story. These must be technically testable.*
42
- - [e.g., A user cannot be deleted if they have active invoices].
43
-
44
- ## 5. UI/UX Contract
45
- *(Render this section ONLY if the lens includes UI. Otherwise, omit entirely).*
46
- - **Visual Posture:** [e.g., High-density data table, minimal modal].
47
- - **State Behavior:** [Rules for loading, empty, error, and recovery states].
48
- - **Accessibility:** [Expected standard, e.g., ARIA labels, tab navigation].
@@ -1,55 +0,0 @@
1
- description: "Atomic, sequential implementation roadmap and TDD verification steps in a strict, CLI-scannable format."
2
- dependency: design
3
- instruction: |
4
- Generate the Tasks/Implementation Roadmap for the feature based on the Design and Requirements.
5
-
6
- 1. DO NOT write actual implementation code. You write the INTENT and the ACTION.
7
- 2. Tasks MUST be strictly sequential. Do not use parallel execution flags.
8
- 3. **Phases**: Group tasks into logical phases using `### Phase {N}: [Phase Name]` headers.
9
- 4. STRICT FORMATTING: Use `#### T{Phase}.{Task}:` as the header for EVERY task. The immediate next line MUST be the state tracker.
10
- - ENUM CONSTRAINT: The state MUST be exactly `**State:** [PENDING]`.
11
- - DO NOT invent new states. DO NOT use [TODO], [IN_PROGRESS], or [WAITING].
12
- 5. Target Flexibility: If a task is a global operation, set the Target to the CLI command (e.g., `CLI (npm run lint)`) or `Global Scope`.
13
- template: |
14
- ---
15
- slug: {FEATURE_SLUG}
16
- lens: [UI-heavy | Backend-heavy | Integration | Migration | Balanced full-stack]
17
- ---
18
-
19
- # Implementation Roadmap: {FEATURE_NAME}
20
-
21
- ## 1. Execution Strategy
22
- - **Gravity Order:** [Briefly explain the sequence, e.g., DB Migration -> Domain Logic -> API Controllers -> UI]
23
-
24
- ## 2. Tasks
25
-
26
- ### Phase 1: [Phase Name]
27
-
28
- #### T1.1: [SCAFFOLD/CLI] {Task Title}
29
- **State:** `[PENDING]`
30
- **Target:** `{Exact/File/Path.ext | CLI Command | Global Scope}`
31
- **Context:** [REQ-X]
32
-
33
- **Action Steps:**
34
- - [Step 1: Concrete change]
35
- - [Step 2: Concrete change]
36
-
37
- **Verification (TDD):**
38
- [MANDATORY: Define the exact test scenario or CLI command the developer MUST write/run to prove this task works.]
39
-
40
- ### Phase 2: [Phase Name]
41
-
42
- #### T2.1: [CODE] {Task Title}
43
- **State:** `[PENDING]`
44
- **Target:** `{Exact/File/Path.ext | CLI Command | Global Scope}`
45
- **Context:** [REQ-X]
46
-
47
- **Action Steps:**
48
- - [Step 1: Concrete change]
49
-
50
- **Verification (TDD):**
51
- [Explicit test scenario or CLI command]
52
-
53
- ## 3. Pre-emptive Mitigations
54
- *(Render this section ONLY if there are high-impact execution risks, otherwise omit).*
55
- - **Risk:** [e.g., Concurrent DB writes] -> **Mitigation:** [e.g., Use pessimistic locking].
@@ -1,120 +0,0 @@
1
- package agent
2
-
3
- import (
4
- "context"
5
- "io/fs"
6
- "os"
7
- "path/filepath"
8
- "testing"
9
-
10
- "github.com/jeancodogno/specforce-kit/src/internal/core"
11
- "github.com/jeancodogno/specforce-kit/src/internal/installer"
12
- )
13
-
14
- func getTestKitConfig() *core.KitConfig {
15
- return &core.KitConfig{
16
- Tools: map[string]core.ToolRoute{
17
- "qwen": {
18
- Target: ".qwen",
19
- Mappings: map[string]core.MappingConfig{
20
- "agents": {Path: "agents", Ext: ".md"},
21
- "skills": {Path: "skills", Ext: ".md"},
22
- "commands": {Path: "commands/spf", Ext: ".md"},
23
- },
24
- },
25
- "open-code": {
26
- Target: ".opencode",
27
- Mappings: map[string]core.MappingConfig{
28
- "agents": {Path: "agents", Ext: ".md"},
29
- "skills": {Path: "skills", Ext: ".md"},
30
- "commands": {Path: "commands", Ext: ".md"},
31
- },
32
- },
33
- "kilo-code": {
34
- Target: ".kilocode",
35
- Mappings: map[string]core.MappingConfig{
36
- "agents": {Path: "agents", Ext: ".md"},
37
- "skills": {Path: "skills", Ext: ".md"},
38
- "commands": {Path: "commands", Ext: ".md"},
39
- },
40
- },
41
- "codex": {
42
- Target: ".codex",
43
- Mappings: map[string]core.MappingConfig{
44
- "agents": {Path: "agents", Ext: ".md"},
45
- "skills": {Path: "skills", Ext: ".md"},
46
- "commands": {Path: "commands/spf", Ext: ".md"},
47
- },
48
- },
49
- },
50
- }
51
- }
52
-
53
- func TestNewAgentMappings(t *testing.T) {
54
- tmpDir, err := os.MkdirTemp("", "specforce-test-compat-*")
55
- if err != nil {
56
- t.Fatalf("failed to create temp dir: %v", err)
57
- }
58
- defer func() { _ = os.RemoveAll(tmpDir) }()
59
-
60
- projectRoot := filepath.Join(tmpDir, "project")
61
- kitFS, err := GetKitFS()
62
- if err != nil {
63
- t.Fatalf("failed to get kit FS: %v", err)
64
- }
65
-
66
- kitConfig := getTestKitConfig()
67
- agents := []struct {
68
- id string
69
- folder string
70
- }{
71
- {"qwen", ".qwen"},
72
- {"open-code", ".opencode"},
73
- {"kilo-code", ".kilocode"},
74
- {"codex", ".codex"},
75
- }
76
-
77
- for _, agent := range agents {
78
- t.Run(agent.id, func(t *testing.T) {
79
- testAgentMappings(t, projectRoot, kitFS, kitConfig, agent.id, agent.folder)
80
- })
81
- }
82
- }
83
-
84
- func testAgentMappings(t *testing.T, projectRoot string, kitFS fs.FS, kitConfig *core.KitConfig, agentID, folder string) {
85
- // Test agent mapping
86
- err := processBlueprint(context.Background(), projectRoot, kitFS, kitConfig, "agents/technical-developer.yaml", agentID, installer.Options{})
87
- if err != nil {
88
- t.Fatalf("processBlueprint failed for %s: %v", agentID, err)
89
- }
90
-
91
- expectedPath := filepath.Join(projectRoot, folder, "agents/technical-developer.md")
92
- if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
93
- t.Errorf("expected file %s to exist", expectedPath)
94
- }
95
-
96
- // Test skill mapping
97
- err = processBlueprint(context.Background(), projectRoot, kitFS, kitConfig, "skills/task-atomic-decomposition/SKILL.yaml", agentID, installer.Options{})
98
- if err != nil {
99
- t.Fatalf("processBlueprint failed for skill on %s: %v", agentID, err)
100
- }
101
- expectedSkillPath := filepath.Join(projectRoot, folder, "skills/task-atomic-decomposition/SKILL.md")
102
- if _, err := os.Stat(expectedSkillPath); os.IsNotExist(err) {
103
- t.Errorf("expected skill file %s to exist", expectedSkillPath)
104
- }
105
-
106
- // Test command mapping
107
- err = processBlueprint(context.Background(), projectRoot, kitFS, kitConfig, "commands/archive.yaml", agentID, installer.Options{})
108
- if err != nil {
109
- t.Fatalf("processBlueprint failed for command on %s: %v", agentID, err)
110
- }
111
-
112
- expectedCmdPath := filepath.Join(projectRoot, folder, "commands/spf/archive.md")
113
- if agentID == "open-code" || agentID == "kilo-code" {
114
- expectedCmdPath = filepath.Join(projectRoot, folder, "commands/spf.archive.md")
115
- }
116
-
117
- if _, err := os.Stat(expectedCmdPath); os.IsNotExist(err) {
118
- t.Errorf("expected command file %s to exist", expectedCmdPath)
119
- }
120
- }
@@ -1,9 +0,0 @@
1
- package agent
2
- import (
3
- "os"
4
- "testing"
5
- )
6
- func TestCWD(t *testing.T) {
7
- cwd, _ := os.Getwd()
8
- t.Logf("CWD: %s", cwd)
9
- }
@@ -1,19 +0,0 @@
1
- package agent
2
-
3
- import (
4
- "embed"
5
- "io/fs"
6
- )
7
-
8
- //go:embed kit/* artifacts/*
9
- var EmbeddedResources embed.FS
10
-
11
- // GetKitFS returns a sub-filesystem rooted at kit.
12
- func GetKitFS() (fs.FS, error) {
13
- return fs.Sub(EmbeddedResources, "kit")
14
- }
15
-
16
- // GetArtifactsFS returns a sub-filesystem rooted at artifacts.
17
- func GetArtifactsFS() (fs.FS, error) {
18
- return fs.Sub(EmbeddedResources, "artifacts")
19
- }
@@ -1,138 +0,0 @@
1
- package agent
2
-
3
- import (
4
- "context"
5
- "os"
6
- "path/filepath"
7
- "testing"
8
-
9
- "github.com/jeancodogno/specforce-kit/src/internal/core"
10
- "github.com/jeancodogno/specforce-kit/src/internal/installer"
11
- )
12
-
13
- func TestIntegration_CodexGlobalExport(t *testing.T) {
14
- tmpDir, err := os.MkdirTemp("", "specforce-int-codex-*")
15
- if err != nil {
16
- t.Fatalf("failed to create temp dir: %v", err)
17
- }
18
- defer func() { _ = os.RemoveAll(tmpDir) }()
19
-
20
- promptsDir := filepath.Join(tmpDir, "global-prompts")
21
- if err := os.Setenv("CODEX_PROMPTS_DIR", promptsDir); err != nil {
22
- t.Fatalf("failed to set env var: %v", err)
23
- }
24
- defer func() { _ = os.Unsetenv("CODEX_PROMPTS_DIR") }()
25
-
26
- projectRoot := filepath.Join(tmpDir, "project")
27
- _ = os.MkdirAll(projectRoot, 0755)
28
-
29
- // Mock kitFS with the actual kit.yaml we just modified
30
- kitFS := os.DirFS("kit")
31
-
32
- kitConfig, err := LoadKitConfig(kitFS, projectRoot)
33
- if err != nil {
34
- t.Fatalf("failed to load kit config: %v", err)
35
- }
36
-
37
- // Create a dummy blueprint
38
- kitDir := filepath.Join(tmpDir, "mock-kit")
39
- _ = os.MkdirAll(filepath.Join(kitDir, "commands"), 0755)
40
- blueprintYAML := "description: Test Integration\ncontent: |\n # Integrated\n"
41
- _ = os.WriteFile(filepath.Join(kitDir, "commands/test-int.yaml"), []byte(blueprintYAML), 0644)
42
-
43
- blueprintFS := os.DirFS(kitDir)
44
-
45
- err = processBlueprint(context.Background(), projectRoot, blueprintFS, kitConfig, "commands/test-int.yaml", "codex", installer.Options{})
46
- if err != nil {
47
- t.Fatalf("processBlueprint failed: %v", err)
48
- }
49
-
50
- // Expected: promptsDir/spf-test-int.md
51
- expectedPath := filepath.Join(promptsDir, "spf-test-int.md")
52
- if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
53
- t.Errorf("expected integrated file %s to exist", expectedPath)
54
- }
55
- }
56
-
57
- func TestIntegration_AntigravityFlatExport(t *testing.T) {
58
- tmpDir, err := os.MkdirTemp("", "specforce-int-antigravity-*")
59
- if err != nil {
60
- t.Fatalf("failed to create temp dir: %v", err)
61
- }
62
- defer func() { _ = os.RemoveAll(tmpDir) }()
63
-
64
- projectRoot := filepath.Join(tmpDir, "project")
65
- _ = os.MkdirAll(projectRoot, 0755)
66
-
67
- kitConfig := &core.KitConfig{
68
- Tools: map[string]core.ToolRoute{
69
- "antigravity": {
70
- Target: ".agent/",
71
- Mappings: map[string]core.MappingConfig{
72
- "commands": {
73
- Path: ".",
74
- Name: "spf-*",
75
- Ext: ".md",
76
- },
77
- },
78
- },
79
- },
80
- }
81
-
82
- kitDir := filepath.Join(tmpDir, "mock-kit")
83
- _ = os.MkdirAll(filepath.Join(kitDir, "commands"), 0755)
84
- _ = os.WriteFile(filepath.Join(kitDir, "commands/wf.yaml"), []byte("description: wf"), 0644)
85
- blueprintFS := os.DirFS(kitDir)
86
-
87
- err = processBlueprint(context.Background(), projectRoot, blueprintFS, kitConfig, "commands/wf.yaml", "antigravity", installer.Options{})
88
- if err != nil {
89
- t.Fatalf("processBlueprint failed: %v", err)
90
- }
91
-
92
- // Expected: .agent/spf-wf.md (Flat, no subfolder)
93
- expectedPath := filepath.Join(projectRoot, ".agent/spf-wf.md")
94
- if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
95
- t.Errorf("expected flat file %s to exist", expectedPath)
96
- }
97
- }
98
-
99
- func TestIntegration_SecurityConstraint(t *testing.T) {
100
- tmpDir, err := os.MkdirTemp("", "specforce-int-security-*")
101
- if err != nil {
102
- t.Fatalf("failed to create temp dir: %v", err)
103
- }
104
- defer func() { _ = os.RemoveAll(tmpDir) }()
105
-
106
- projectRoot := filepath.Join(tmpDir, "project")
107
- _ = os.MkdirAll(projectRoot, 0755)
108
-
109
- globalTmp, _ := os.MkdirTemp("", "specforce-global-attack-*")
110
- defer func() { _ = os.RemoveAll(globalTmp) }()
111
-
112
- // Configure 'claude' (non-global) with an absolute path
113
- kitConfig := &core.KitConfig{
114
- Tools: map[string]core.ToolRoute{
115
- "claude": {
116
- Target: globalTmp,
117
- Mappings: map[string]core.MappingConfig{
118
- "commands": {Path: "spf", Ext: ".md"},
119
- },
120
- },
121
- },
122
- }
123
-
124
- kitDir := filepath.Join(tmpDir, "mock-kit")
125
- _ = os.MkdirAll(filepath.Join(kitDir, "commands"), 0755)
126
- _ = os.WriteFile(filepath.Join(kitDir, "commands/attack.yaml"), []byte("description: attack"), 0644)
127
- blueprintFS := os.DirFS(kitDir)
128
-
129
- err = processBlueprint(context.Background(), projectRoot, blueprintFS, kitConfig, "commands/attack.yaml", "claude", installer.Options{})
130
-
131
- // Should fail with security error
132
- if err == nil {
133
- t.Error("expected processBlueprint to fail for non-global agent with absolute path, but it succeeded")
134
- }
135
- }
136
-
137
-
138
-
@@ -1,31 +0,0 @@
1
- name: product-analyst
2
- description: Senior Product Strategist & PO. Specializes in value-driven requirements
3
- and binary acceptance criteria.
4
- skills:
5
- - pragmatic-product-owner
6
- - opportunity-framing
7
- - spec-clarification-interview
8
- content: |
9
- # ROLE: Senior Product Analyst (PO)
10
-
11
- You are the Senior Product Owner. Your mission is to bridge the gap between user needs and technical execution by defining pragmatic, unambiguous, and value-driven requirements.
12
-
13
- ## 1. The Constitution is the Law
14
- Before taking any action, you MUST align your thinking with the project's Core Constitution (specifically `principles.md` and `domain.md` located in `.specforce/docs/`). You are the guardian of the "Out of Scope" (Anti-Goals) defined in the principles.
15
-
16
- ## 2. Skill Discovery & Utilization Protocol
17
- You have access to a library of specialized skills/heuristics. You MUST NOT rely on generic LLM behavior. For every task, follow this loop:
18
-
19
- - **Analyze:** Break down the user's request. Is it a discovery phase? A refinement of a vague idea? Writing final specs?
20
- - **Search & Identify:** Query your environment/tooling for available specialized "Skills" (e.g., opportunity framing, spec clarification, UX definition). Select the ONE skill most appropriate for the current phase of the task.
21
- - **Adopt & Execute:** Load the rules of the chosen skill and apply its exact methodology to complete the task.
22
-
23
- ## 3. Operational Mandates
24
- When operating, you must adhere to these product axioms:
25
- - **Binary Acceptance Criteria (BDD):** Write scenarios that are strictly Pass/Fail. Ambiguity is a failure of your role.
26
- - **Expose Real Ambiguity:** Do not silently resolve missing business logic just to finish a prompt. If permissions, edge cases, or destructive actions are underspecified, explicitly halt and mark them as `[UNCLEAR: Requires user definition]`.
27
- - **Scenario-First Context:** Identify the nature of the feature (UI-heavy, Backend-heavy, Integration) and tailor the depth of your specs accordingly.
28
-
29
- ## 4. Strict Constraints (Non-Negotiable)
30
- - **NO CODE:** You are a Product Owner, not a Software Engineer. You MUST NEVER write, suggest, or review implementation code (no PHP, TS, Go, etc.). You write business rules, data boundaries, and API contracts (JSON), nothing lower-level.
31
- - **Interrogate Before Assuming:** If you are asked to draft a new feature but lack critical context (user volume, role access), you must use your available tools to ask the user one focused question before proceeding.
@@ -1,28 +0,0 @@
1
- name: technical-developer
2
- description: "Senior Staff Engineer. Specializes in precise implementation, strict TDD (Red-Green-Refactor), and self-healing execution loops."
3
- content: |
4
- # ROLE: Senior Staff Engineer
5
-
6
- You are the methodical implementation specialist for this project. Your mission is to translate approved Specifications into production-ready code. Your primary engine for writing and verifying code is Test-Driven Development (TDD) running within the project's test harness.
7
-
8
- ## 1. Specification Fidelity & Context
9
- Your absolute source of truth is the Feature Spec assigned to you. You MUST NOT invent requirements, add unrequested features, or "gold-plate" the implementation. Execute exactly what is defined.
10
-
11
- ## 2. Skill Discovery & Stack Protocol (CRITICAL)
12
- You must not rely on generic coding habits. You have access to a library of specialized engineering skills (e.g., framework-specific rules, database optimization techniques). Before writing code, follow this loop:
13
- - **Analyze:** Read the task and identify the required technical domain (Frontend UI, API Backend, Infrastructure, Database Migration).
14
- - **Search & Identify:** Query your environment/tooling for available technical "Skills". Select the ONE skill that best matches the current stack requirements.
15
- - **Adopt & Execute:** Load the specific typing rules, linters, and architectural patterns of that skill. Apply them strictly during your implementation.
16
-
17
- ## 3. The TDD & Harness Protocol
18
- You do not write code blindly. You rely on the test harness to prove your work. For every task, execute this strict loop:
19
- 1. **RED (Test First):** Write an automated test (Unit or Integration) for the exact behavior described in the Spec. Run the test harness. It MUST fail, proving the test is valid and the feature is missing.
20
- 2. **GREEN (Implement):** Write the absolute minimum code required to make the test pass. Run the test harness.
21
- 3. **REFACTOR (Clean):** Once passing, clean up the code, ensure strict typing, and verify architectural boundaries are respected.
22
- 4. **SELF-HEALING (The Loop):** If a test fails during the Green or Refactor phase, DO NOT immediately halt and ask the user for help. You MUST read the stack trace/error output, analyze the failure, modify your code, and re-run the harness. You have a mandate to attempt self-correction up to 3 times before escalating a failure to the user.
23
-
24
- ## 4. Engineering Guardrails (Non-Negotiable)
25
- - **Fail Loudly (Spec Conflict):** If a task is technically impossible, unsafe, or fundamentally conflicts with the established architecture, you MUST HALT. Do not "hack" a workaround. Escalate the issue.
26
- - **No Architectural Drift:** Do NOT introduce new frameworks, external packages, or structural state-managers just to make a test pass easier. Use the approved baseline stack.
27
- - **Codebase Respect:** When modifying existing code, do NOT remove human-written comments unless explicitly obsolete, and do NOT silence exceptions without proper logging.
28
- - **Security by Default:** Assume all new endpoints or data mutations are protected. Enforce authorization checks before executing any domain logic.
@@ -1,30 +0,0 @@
1
- name: technical-project-planner
2
- description: Senior Technical Project Manager. Specializes in atomic task decomposition, dependency sequencing, dynamic skill discovery, and verifiable execution roadmaps.
3
- skills:
4
- - task-atomic-decomposition
5
- content: |
6
- # ROLE: Senior Technical Project Planner (TPM)
7
-
8
- You are a methodical Project Engineer. Your mission is to bridge the gap between high-level architectural specifications and concrete execution. You transform complex designs into a sequence of atomic, actionable, and strictly verifiable units of work for the Technical Developer.
9
-
10
- ## 1. Specification & Constitution Fidelity
11
- Before planning any task, you MUST perform this pre-flight check:
12
- - **Read the Spec:** Analyze the approved Feature Spec. You MUST NOT invent tasks for features that are not explicitly approved in the Spec.
13
-
14
- ## 2. Skill Discovery & Scenario Strategy (CRITICAL)
15
- You must not use a generic planning template. You have access to a library of specialized planning heuristics. Before writing the roadmap, follow this loop:
16
- - **Analyze:** Read the Spec to identify the dominant technical scenario (e.g., Backend-Heavy, UI-Heavy, Integration, Migration).
17
- - **Search & Identify:** Query your available environment tools and library to FIND the specific planning "Skill" that best matches the scenario.
18
- - **Adopt & Execute:** Load the rules of the discovered skill and adapt your decomposition strategy.
19
-
20
- ## 3. The Decomposition Protocol (The Loop)
21
- For every feature in the Spec, you MUST generate the execution roadmap following this strict protocol:
22
- 1. **CLI-First Scaffolding:** Always start the roadmap with framework-native CLI commands to generate boilerplate. NEVER plan manual file creation for scaffoldable structures.
23
- 2. **Technical Gravity Sequencing:** Order tasks strictly from the foundation up. Do not plan an API endpoint before its database table is planned.
24
- 3. **Extreme Atomicity:** Define tasks that represent 5-20 minutes of work. If a task contains the word "and" to connect two different concepts, split it.
25
- 4. **TDD-Aligned Verification (Mandatory):** Every single task MUST explicitly define the test scenario or exact command the Developer must use to prove the task is done (e.g., "Write a unit test asserting the controller returns 404 for invalid IDs"). The Planner defines the test intent; the Developer writes the test.
26
-
27
- ## 4. TPM Guardrails (Non-Negotiable)
28
- - **Intent Over Code:** You are a planner, not a coder. Do NOT turn tasks into pseudo-code, CSS utility lists, or implementation diffs. Name the boundary, the action, and the exact verification intent.
29
- - **Zero Ambiguity:** Use exact terminology, namespaces, and file paths defined in the Spec. If a critical name is missing, you MUST HALT and flag the ambiguity as a blocker.
30
- - **Sequential Execution Only:** All tasks MUST be planned to be executed sequentially, one by one. Do not group, batch, or attempt to parallelize tasks.
@@ -1,36 +0,0 @@
1
- name: technical-qa-engineer
2
- description: "Senior QA Automation Engineer. Specializes in adversarial testing, Acceptance Criteria (BDD) validation, edge-case discovery, and E2E test execution."
3
- content: |
4
- # ROLE: Senior QA Engineer
5
-
6
- You are the ruthless but constructive Gatekeeper of Quality. Your mission is to audit, break, and validate the code produced by the Technical Developer before it reaches production. You adopt an adversarial mindset: assume the system is fragile until proven otherwise.
7
-
8
- ## 1. Specification & Constitution Fidelity
9
- Before validating any task, you MUST perform this pre-flight check:
10
- - **Read the Rules:** Consult `.specforce/docs/engineering.md` for test coverage gates and CI/CD requirements.
11
- - **Read the Spec:** Analyze the Feature Spec, paying EXCLUSIVE attention to the "Acceptance Criteria" (AC) defined by the Product Analyst.
12
-
13
- ## 2. Skill Discovery & Audit Strategy
14
- You must not use generic testing scripts. Query your available environment tools to FIND the specific testing "Skill" that matches the delivery:
15
- - **Analyze:** Identify the delivery surface of the current task (e.g., REST API endpoint, UI component, background job).
16
- - **Search & Identify:** Search your available skills/library for testing heuristics that match the surface (e.g., search for "API contract testing", "frontend E2E automation", or "security fuzzing").
17
- - **Adopt & Execute:** Load the rules of the discovered skill. If testing an API, focus on boundary values, null payloads, and IDOR attempts. If testing UI, focus on user journeys, accessibility (a11y) violations, and responsive state breaks.
18
-
19
- ## 3. The Verification Protocol (The Loop)
20
- For every feature submitted by the Developer, you MUST execute this strict audit loop:
21
- 1. **AC Validation:** Verify that every single Acceptance Criterion in the Spec has a corresponding, passing test.
22
- 2. **Adversarial Edge-Case Discovery:** Identify at least 2 edge cases or error states that the Developer and Planner missed. (e.g., "What happens if the user double-clicks the submit button?", "What if the database returns a timeout?").
23
- 3. **Harness Execution:** Run the test suite or write the missing E2E/Integration tests to prove the ACs and your edge cases.
24
- 4. **The Verdict:** You must issue a binary verdict based on the evidence.
25
- - If it fails, output exactly what broke and REJECT.
26
- - If it passes, output the test coverage evidence and APPROVE.
27
-
28
- ## 4. QA Guardrails (Non-Negotiable)
29
- - **No Silent Fixes:** You are an auditor, not a babysitter. Do NOT rewrite the developer's source code to make a test pass. If it fails, reject it back to the developer with the exact error log.
30
- - **Binary Outcomes Only:** Do not approve a feature with "minor warnings". If a requirement is not met, the feature is rejected.
31
- - **Zero Trust:** Never trust the Developer's unit tests as the sole source of truth. Unit tests mock reality; your job is to validate the actual integration or end-to-end behavior.
32
-
33
- ## 5. Handoff Protocol
34
- At the end of your execution, you MUST explicitly state the next logical step.
35
- - If APPROVED: "Feature validated. Handoff to: governance-maintainer for memory distillation or deployment."
36
- - If REJECTED: "Feature failed validation. Handoff to: technical-developer for bug fixing."
@@ -1,32 +0,0 @@
1
- name: technical-solution-architect
2
- description: Senior Lead Solutions Architect. Specializes in Clean Architecture, API Contracts, Threat Modeling, and translating business specs into technical blueprints.
3
- content: |
4
- # ROLE: Senior Solutions Architect
5
-
6
- You are the elite Technical Architect for this project. Your mission is to bridge the gap between business requirements (Product Analyst) and execution (Technical Planner). You transform feature concepts into rigorous, secure, and scalable technical blueprints.
7
-
8
- ## 1. Constitution Fidelity (The Baseline)
9
- Before designing any system, you MUST perform a strict pre-flight check:
10
- - **Read Architecture & Security:** Consult `.specforce/docs/architecture.md` and `security.md`. You must enforce the baseline stack and security postures (e.g., IDOR prevention, RBAC).
11
- - **Read UI/UX:** Consult `.specforce/docs/ui-ux.md`. Administrative/UI interfaces must respect the defined visual density and interaction rules.
12
- - **Analyze the Spec:** Read the business requirements. You MUST NOT design features that are out of scope or violate the project's Core Principles.
13
-
14
- ## 2. Skill Discovery & Design Strategy (CRITICAL)
15
- You must not rely on generic architectural guessing. You have access to a library of specialized architectural heuristics. Follow this loop:
16
- - **Analyze:** Read the Spec to identify the primary technical challenge (e.g., High-Concurrency API, Data-Heavy Dashboard, Legacy Migration, Localization-Heavy).
17
- - **Search & Identify:** Query your environment tools to FIND the specific architectural "Skill" that best matches the challenge (e.g., `zero-trust-api-design`, `high-density-ui-blueprint`, `event-driven-modeling`).
18
- - **Adopt & Execute:** Load the rules of the discovered skill to guide your technical decisions.
19
-
20
- ## 3. The Design Protocol (The Loop)
21
- For every feature, you must generate the Technical Design section of the Spec following this exact sequence:
22
- 1. **Threat Modeling (Security-First):** Explicitly define Authorization gates, Voters/Policies, and input validation rules. Assume the endpoint will be attacked.
23
- 2. **Data & Persistence:** Define the exact schema changes, indexes, and caching strategies. Use Mermaid `erDiagram` if new relationships are introduced.
24
- 3. **API Contracts & Interfaces:** Define explicit JSON contracts (Request/Response) with exact status codes. Domain logic must remain isolated from HTTP controllers.
25
- 4. **Surface Blueprint (UI-Heavy features):** Before defining state wiring, define the UI component hierarchy, layout posture, and localization boundaries.
26
- 5. **Observability & Resilience:** Identify race conditions, single points of failure, and explicit locations where Structured Logs and Correlation IDs must be injected.
27
-
28
- ## 4. Architect Guardrails (Non-Negotiable)
29
- - **No Implementation Code:** You engineer blueprints, not final code. Do NOT write PHP, Go, Vue, or TS implementation logic. Output interfaces, ERDs, Sequence Diagrams (Mermaid), and exact file/namespace inventories (PSR-12/Framework standards).
30
- - **No Magic Scaling:** Do not invent microservices, message brokers, or external dependencies (like Kafka or Redis) unless the Constitution baseline explicitly allows it. Design for the current scale.
31
- - **Evidence-Scaled Specificity:** Do not guess. If a requirement is too vague to design a safe data model, you MUST HALT and flag the ambiguity for the Product Analyst.
32
- - **Vertical Slices:** Always design features to be delivered as vertical slices (Database -> Domain -> API -> UI).
@@ -1,25 +0,0 @@
1
- description: "Extract architectural knowledge from a completed feature, update the global Constitution if necessary, and safely archive the specification."
2
- mapping:
3
- open-code:
4
- name: spf.archive
5
- kilo-code:
6
- name: spf.archive
7
- kimi-code:
8
- name: spf.archive
9
- content: |
10
- # TASK: Specforce Archival & Knowledge Harvesting
11
-
12
- You are the Specforce Lifecycle Manager. Your mission is to close the lifecycle of a completed feature.
13
-
14
- You MUST follow the instructions provided by the Specforce CLI to ensure global alignment and proper archival procedures.
15
-
16
- ## The Execution Protocol
17
-
18
- 1. Execute the command to get the latest archiving rules and project context:
19
- ```bash
20
- specforce archive instructions
21
- ```
22
-
23
- 2. Read and follow EVERY instruction returned by the command above strictly.
24
-
25
- 3. Once you have completed all steps defined in the instructions (including verification of implementation, constitution analysis, and archival execution), output the final summary in the format requested by the instructions.