@cognite/cli 0.5.2 → 0.6.0-alpha.8
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.
- package/README.md +118 -33
- package/_templates/app/new/config/eslint.config.mjs.ejs.t +99 -0
- package/_templates/app/new/config/tsconfig.json.ejs.t +35 -0
- package/_templates/app/new/config/tsconfig.node.json.ejs.t +27 -0
- package/_templates/app/new/config/vite.config.ts.ejs.t +26 -0
- package/_templates/app/new/config/vitest.config.ts.ejs.t +14 -0
- package/_templates/app/new/config/vitest.setup.ts.ejs.t +4 -0
- package/_templates/app/new/cursor/data-modeling.mdc.ejs.t +1996 -0
- package/_templates/app/new/cursor/mcp.json.ejs.t +10 -0
- package/_templates/app/new/cursor/rules.mdc.ejs.t +10 -0
- package/_templates/app/new/github/ci.yml.ejs.t +36 -0
- package/_templates/app/new/prompt.js +49 -0
- package/_templates/app/new/root/.npmrc.ejs.t +4 -0
- package/_templates/app/new/root/AGENTS.md.ejs.t +215 -0
- package/_templates/app/new/root/SPEC.md.ejs.t +77 -0
- package/_templates/app/new/root/app.json.ejs.t +22 -0
- package/_templates/app/new/root/gitignore.ejs.t +21 -0
- package/_templates/app/new/root/index.html.ejs.t +36 -0
- package/_templates/app/new/root/package.json.ejs.t +67 -0
- package/_templates/app/new/src/App.test.tsx.ejs.t +45 -0
- package/_templates/app/new/src/App.tsx.ejs.t +265 -0
- package/_templates/app/new/src/lib/utils.ts.ejs.t +9 -0
- package/_templates/app/new/src/main.tsx.ejs.t +36 -0
- package/_templates/app/new/src/styles.css.ejs.t +12 -0
- package/_vendor/spec-kit/.version +4 -0
- package/_vendor/spec-kit/README.md +39 -0
- package/_vendor/spec-kit/commands/speckit.analyze.md +249 -0
- package/_vendor/spec-kit/commands/speckit.checklist.md +361 -0
- package/_vendor/spec-kit/commands/speckit.clarify.md +247 -0
- package/_vendor/spec-kit/commands/speckit.implement.md +198 -0
- package/_vendor/spec-kit/commands/speckit.plan.md +149 -0
- package/_vendor/spec-kit/commands/speckit.specify.md +327 -0
- package/_vendor/spec-kit/commands/speckit.tasks.md +200 -0
- package/_vendor/spec-kit/scripts/bash/check-prerequisites.sh +190 -0
- package/_vendor/spec-kit/scripts/bash/common.sh +645 -0
- package/_vendor/spec-kit/scripts/bash/setup-plan.sh +75 -0
- package/_vendor/spec-kit/templates/checklist-template.md +40 -0
- package/_vendor/spec-kit/templates/plan-template.md +104 -0
- package/_vendor/spec-kit/templates/spec-template.md +128 -0
- package/_vendor/spec-kit/templates/tasks-template.md +251 -0
- package/dist/chunk-GFMJ4MJZ.js +8 -0
- package/dist/cli/cli.js +347 -0
- package/dist/skills-4R3OUI44.js +2 -0
- package/package.json +25 -17
- package/index.js +0 -116
- package/operations.js +0 -113
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Analyze For Consistency
|
|
5
|
+
agent: speckit.analyze
|
|
6
|
+
prompt: Run a project analysis for consistency
|
|
7
|
+
send: true
|
|
8
|
+
- label: Implement Project
|
|
9
|
+
agent: speckit.implement
|
|
10
|
+
prompt: Start the implementation in phases
|
|
11
|
+
send: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## User Input
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
$ARGUMENTS
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
21
|
+
|
|
22
|
+
## Pre-Execution Checks
|
|
23
|
+
|
|
24
|
+
**Check for extension hooks (before tasks generation)**:
|
|
25
|
+
- Check if `.specify/extensions.yml` exists in the project root.
|
|
26
|
+
- If it exists, read it and look for entries under the `hooks.before_tasks` key
|
|
27
|
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
|
28
|
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
|
29
|
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
|
30
|
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
|
31
|
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
|
32
|
+
- For each executable hook, output the following based on its `optional` flag:
|
|
33
|
+
- **Optional hook** (`optional: true`):
|
|
34
|
+
```
|
|
35
|
+
## Extension Hooks
|
|
36
|
+
|
|
37
|
+
**Optional Pre-Hook**: {extension}
|
|
38
|
+
Command: `/{command}`
|
|
39
|
+
Description: {description}
|
|
40
|
+
|
|
41
|
+
Prompt: {prompt}
|
|
42
|
+
To execute: `/{command}`
|
|
43
|
+
```
|
|
44
|
+
- **Mandatory hook** (`optional: false`):
|
|
45
|
+
```
|
|
46
|
+
## Extension Hooks
|
|
47
|
+
|
|
48
|
+
**Automatic Pre-Hook**: {extension}
|
|
49
|
+
Executing: `/{command}`
|
|
50
|
+
EXECUTE_COMMAND: {command}
|
|
51
|
+
|
|
52
|
+
Wait for the result of the hook command before proceeding to the Outline.
|
|
53
|
+
```
|
|
54
|
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
|
55
|
+
|
|
56
|
+
## Outline
|
|
57
|
+
|
|
58
|
+
1. **Setup**: Run `.specify/scripts/bash/check-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
|
|
59
|
+
|
|
60
|
+
2. **Load design documents**: Read from FEATURE_DIR:
|
|
61
|
+
- **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
|
|
62
|
+
- **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
|
|
63
|
+
- Note: Not all projects have all documents. Generate tasks based on what's available.
|
|
64
|
+
|
|
65
|
+
3. **Execute task generation workflow**:
|
|
66
|
+
- Load plan.md and extract tech stack, libraries, project structure
|
|
67
|
+
- Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
|
|
68
|
+
- If data-model.md exists: Extract entities and map to user stories
|
|
69
|
+
- If contracts/ exists: Map interface contracts to user stories
|
|
70
|
+
- If research.md exists: Extract decisions for setup tasks
|
|
71
|
+
- Generate tasks organized by user story (see Task Generation Rules below)
|
|
72
|
+
- Generate dependency graph showing user story completion order
|
|
73
|
+
- Create parallel execution examples per user story
|
|
74
|
+
- Validate task completeness (each user story has all needed tasks, independently testable)
|
|
75
|
+
|
|
76
|
+
4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with:
|
|
77
|
+
- Correct feature name from plan.md
|
|
78
|
+
- Phase 1: Setup tasks (project initialization)
|
|
79
|
+
- Phase 2: Foundational tasks (blocking prerequisites for all user stories)
|
|
80
|
+
- Phase 3+: One phase per user story (in priority order from spec.md)
|
|
81
|
+
- Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
|
|
82
|
+
- Final Phase: Polish & cross-cutting concerns
|
|
83
|
+
- All tasks must follow the strict checklist format (see Task Generation Rules below)
|
|
84
|
+
- Clear file paths for each task
|
|
85
|
+
- Dependencies section showing story completion order
|
|
86
|
+
- Parallel execution examples per story
|
|
87
|
+
- Implementation strategy section (MVP first, incremental delivery)
|
|
88
|
+
|
|
89
|
+
5. **Report**: Output path to generated tasks.md and summary:
|
|
90
|
+
- Total task count
|
|
91
|
+
- Task count per user story
|
|
92
|
+
- Parallel opportunities identified
|
|
93
|
+
- Independent test criteria for each story
|
|
94
|
+
- Suggested MVP scope (typically just User Story 1)
|
|
95
|
+
- Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
|
|
96
|
+
|
|
97
|
+
6. **Check for extension hooks**: After tasks.md is generated, check if `.specify/extensions.yml` exists in the project root.
|
|
98
|
+
- If it exists, read it and look for entries under the `hooks.after_tasks` key
|
|
99
|
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
|
100
|
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
|
101
|
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
|
102
|
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
|
103
|
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
|
104
|
+
- For each executable hook, output the following based on its `optional` flag:
|
|
105
|
+
- **Optional hook** (`optional: true`):
|
|
106
|
+
```
|
|
107
|
+
## Extension Hooks
|
|
108
|
+
|
|
109
|
+
**Optional Hook**: {extension}
|
|
110
|
+
Command: `/{command}`
|
|
111
|
+
Description: {description}
|
|
112
|
+
|
|
113
|
+
Prompt: {prompt}
|
|
114
|
+
To execute: `/{command}`
|
|
115
|
+
```
|
|
116
|
+
- **Mandatory hook** (`optional: false`):
|
|
117
|
+
```
|
|
118
|
+
## Extension Hooks
|
|
119
|
+
|
|
120
|
+
**Automatic Hook**: {extension}
|
|
121
|
+
Executing: `/{command}`
|
|
122
|
+
EXECUTE_COMMAND: {command}
|
|
123
|
+
```
|
|
124
|
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
|
125
|
+
|
|
126
|
+
Context for task generation: $ARGUMENTS
|
|
127
|
+
|
|
128
|
+
The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
|
|
129
|
+
|
|
130
|
+
## Task Generation Rules
|
|
131
|
+
|
|
132
|
+
**CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
|
|
133
|
+
|
|
134
|
+
**Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
|
|
135
|
+
|
|
136
|
+
### Checklist Format (REQUIRED)
|
|
137
|
+
|
|
138
|
+
Every task MUST strictly follow this format:
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
- [ ] [TaskID] [P?] [Story?] Description with file path
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Format Components**:
|
|
145
|
+
|
|
146
|
+
1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
|
|
147
|
+
2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
|
|
148
|
+
3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
|
|
149
|
+
4. **[Story] label**: REQUIRED for user story phase tasks only
|
|
150
|
+
- Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
|
|
151
|
+
- Setup phase: NO story label
|
|
152
|
+
- Foundational phase: NO story label
|
|
153
|
+
- User Story phases: MUST have story label
|
|
154
|
+
- Polish phase: NO story label
|
|
155
|
+
5. **Description**: Clear action with exact file path
|
|
156
|
+
|
|
157
|
+
**Examples**:
|
|
158
|
+
|
|
159
|
+
- ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
|
|
160
|
+
- ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
|
|
161
|
+
- ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
|
|
162
|
+
- ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
|
|
163
|
+
- ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
|
|
164
|
+
- ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
|
|
165
|
+
- ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
|
|
166
|
+
- ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
|
|
167
|
+
|
|
168
|
+
### Task Organization
|
|
169
|
+
|
|
170
|
+
1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
|
|
171
|
+
- Each user story (P1, P2, P3...) gets its own phase
|
|
172
|
+
- Map all related components to their story:
|
|
173
|
+
- Models needed for that story
|
|
174
|
+
- Services needed for that story
|
|
175
|
+
- Interfaces/UI needed for that story
|
|
176
|
+
- If tests requested: Tests specific to that story
|
|
177
|
+
- Mark story dependencies (most stories should be independent)
|
|
178
|
+
|
|
179
|
+
2. **From Contracts**:
|
|
180
|
+
- Map each interface contract → to the user story it serves
|
|
181
|
+
- If tests requested: Each interface contract → contract test task [P] before implementation in that story's phase
|
|
182
|
+
|
|
183
|
+
3. **From Data Model**:
|
|
184
|
+
- Map each entity to the user story(ies) that need it
|
|
185
|
+
- If entity serves multiple stories: Put in earliest story or Setup phase
|
|
186
|
+
- Relationships → service layer tasks in appropriate story phase
|
|
187
|
+
|
|
188
|
+
4. **From Setup/Infrastructure**:
|
|
189
|
+
- Shared infrastructure → Setup phase (Phase 1)
|
|
190
|
+
- Foundational/blocking tasks → Foundational phase (Phase 2)
|
|
191
|
+
- Story-specific setup → within that story's phase
|
|
192
|
+
|
|
193
|
+
### Phase Structure
|
|
194
|
+
|
|
195
|
+
- **Phase 1**: Setup (project initialization)
|
|
196
|
+
- **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
|
|
197
|
+
- **Phase 3+**: User Stories in priority order (P1, P2, P3...)
|
|
198
|
+
- Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
|
|
199
|
+
- Each phase should be a complete, independently testable increment
|
|
200
|
+
- **Final Phase**: Polish & Cross-Cutting Concerns
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Consolidated prerequisite checking script
|
|
4
|
+
#
|
|
5
|
+
# This script provides unified prerequisite checking for Spec-Driven Development workflow.
|
|
6
|
+
# It replaces the functionality previously spread across multiple scripts.
|
|
7
|
+
#
|
|
8
|
+
# Usage: ./check-prerequisites.sh [OPTIONS]
|
|
9
|
+
#
|
|
10
|
+
# OPTIONS:
|
|
11
|
+
# --json Output in JSON format
|
|
12
|
+
# --require-tasks Require tasks.md to exist (for implementation phase)
|
|
13
|
+
# --include-tasks Include tasks.md in AVAILABLE_DOCS list
|
|
14
|
+
# --paths-only Only output path variables (no validation)
|
|
15
|
+
# --help, -h Show help message
|
|
16
|
+
#
|
|
17
|
+
# OUTPUTS:
|
|
18
|
+
# JSON mode: {"FEATURE_DIR":"...", "AVAILABLE_DOCS":["..."]}
|
|
19
|
+
# Text mode: FEATURE_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
|
|
20
|
+
# Paths only: REPO_ROOT: ... \n BRANCH: ... \n FEATURE_DIR: ... etc.
|
|
21
|
+
|
|
22
|
+
set -e
|
|
23
|
+
|
|
24
|
+
# Parse command line arguments
|
|
25
|
+
JSON_MODE=false
|
|
26
|
+
REQUIRE_TASKS=false
|
|
27
|
+
INCLUDE_TASKS=false
|
|
28
|
+
PATHS_ONLY=false
|
|
29
|
+
|
|
30
|
+
for arg in "$@"; do
|
|
31
|
+
case "$arg" in
|
|
32
|
+
--json)
|
|
33
|
+
JSON_MODE=true
|
|
34
|
+
;;
|
|
35
|
+
--require-tasks)
|
|
36
|
+
REQUIRE_TASKS=true
|
|
37
|
+
;;
|
|
38
|
+
--include-tasks)
|
|
39
|
+
INCLUDE_TASKS=true
|
|
40
|
+
;;
|
|
41
|
+
--paths-only)
|
|
42
|
+
PATHS_ONLY=true
|
|
43
|
+
;;
|
|
44
|
+
--help|-h)
|
|
45
|
+
cat << 'EOF'
|
|
46
|
+
Usage: check-prerequisites.sh [OPTIONS]
|
|
47
|
+
|
|
48
|
+
Consolidated prerequisite checking for Spec-Driven Development workflow.
|
|
49
|
+
|
|
50
|
+
OPTIONS:
|
|
51
|
+
--json Output in JSON format
|
|
52
|
+
--require-tasks Require tasks.md to exist (for implementation phase)
|
|
53
|
+
--include-tasks Include tasks.md in AVAILABLE_DOCS list
|
|
54
|
+
--paths-only Only output path variables (no prerequisite validation)
|
|
55
|
+
--help, -h Show this help message
|
|
56
|
+
|
|
57
|
+
EXAMPLES:
|
|
58
|
+
# Check task prerequisites (plan.md required)
|
|
59
|
+
./check-prerequisites.sh --json
|
|
60
|
+
|
|
61
|
+
# Check implementation prerequisites (plan.md + tasks.md required)
|
|
62
|
+
./check-prerequisites.sh --json --require-tasks --include-tasks
|
|
63
|
+
|
|
64
|
+
# Get feature paths only (no validation)
|
|
65
|
+
./check-prerequisites.sh --paths-only
|
|
66
|
+
|
|
67
|
+
EOF
|
|
68
|
+
exit 0
|
|
69
|
+
;;
|
|
70
|
+
*)
|
|
71
|
+
echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
|
|
72
|
+
exit 1
|
|
73
|
+
;;
|
|
74
|
+
esac
|
|
75
|
+
done
|
|
76
|
+
|
|
77
|
+
# Source common functions
|
|
78
|
+
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
79
|
+
source "$SCRIPT_DIR/common.sh"
|
|
80
|
+
|
|
81
|
+
# Get feature paths and validate branch
|
|
82
|
+
_paths_output=$(get_feature_paths) || { echo "ERROR: Failed to resolve feature paths" >&2; exit 1; }
|
|
83
|
+
eval "$_paths_output"
|
|
84
|
+
unset _paths_output
|
|
85
|
+
check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
|
|
86
|
+
|
|
87
|
+
# If paths-only mode, output paths and exit (support JSON + paths-only combined)
|
|
88
|
+
if $PATHS_ONLY; then
|
|
89
|
+
if $JSON_MODE; then
|
|
90
|
+
# Minimal JSON paths payload (no validation performed)
|
|
91
|
+
if has_jq; then
|
|
92
|
+
jq -cn \
|
|
93
|
+
--arg repo_root "$REPO_ROOT" \
|
|
94
|
+
--arg branch "$CURRENT_BRANCH" \
|
|
95
|
+
--arg feature_dir "$FEATURE_DIR" \
|
|
96
|
+
--arg feature_spec "$FEATURE_SPEC" \
|
|
97
|
+
--arg impl_plan "$IMPL_PLAN" \
|
|
98
|
+
--arg tasks "$TASKS" \
|
|
99
|
+
'{REPO_ROOT:$repo_root,BRANCH:$branch,FEATURE_DIR:$feature_dir,FEATURE_SPEC:$feature_spec,IMPL_PLAN:$impl_plan,TASKS:$tasks}'
|
|
100
|
+
else
|
|
101
|
+
printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
|
|
102
|
+
"$(json_escape "$REPO_ROOT")" "$(json_escape "$CURRENT_BRANCH")" "$(json_escape "$FEATURE_DIR")" "$(json_escape "$FEATURE_SPEC")" "$(json_escape "$IMPL_PLAN")" "$(json_escape "$TASKS")"
|
|
103
|
+
fi
|
|
104
|
+
else
|
|
105
|
+
echo "REPO_ROOT: $REPO_ROOT"
|
|
106
|
+
echo "BRANCH: $CURRENT_BRANCH"
|
|
107
|
+
echo "FEATURE_DIR: $FEATURE_DIR"
|
|
108
|
+
echo "FEATURE_SPEC: $FEATURE_SPEC"
|
|
109
|
+
echo "IMPL_PLAN: $IMPL_PLAN"
|
|
110
|
+
echo "TASKS: $TASKS"
|
|
111
|
+
fi
|
|
112
|
+
exit 0
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Validate required directories and files
|
|
116
|
+
if [[ ! -d "$FEATURE_DIR" ]]; then
|
|
117
|
+
echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
|
|
118
|
+
echo "Run /speckit.specify first to create the feature structure." >&2
|
|
119
|
+
exit 1
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
if [[ ! -f "$IMPL_PLAN" ]]; then
|
|
123
|
+
echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
|
|
124
|
+
echo "Run /speckit.plan first to create the implementation plan." >&2
|
|
125
|
+
exit 1
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# Check for tasks.md if required
|
|
129
|
+
if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
|
|
130
|
+
echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
|
|
131
|
+
echo "Run /speckit.tasks first to create the task list." >&2
|
|
132
|
+
exit 1
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
# Build list of available documents
|
|
136
|
+
docs=()
|
|
137
|
+
|
|
138
|
+
# Always check these optional docs
|
|
139
|
+
[[ -f "$RESEARCH" ]] && docs+=("research.md")
|
|
140
|
+
[[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
|
|
141
|
+
|
|
142
|
+
# Check contracts directory (only if it exists and has files)
|
|
143
|
+
if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
|
|
144
|
+
docs+=("contracts/")
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
[[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
|
|
148
|
+
|
|
149
|
+
# Include tasks.md if requested and it exists
|
|
150
|
+
if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
|
|
151
|
+
docs+=("tasks.md")
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
# Output results
|
|
155
|
+
if $JSON_MODE; then
|
|
156
|
+
# Build JSON array of documents
|
|
157
|
+
if has_jq; then
|
|
158
|
+
if [[ ${#docs[@]} -eq 0 ]]; then
|
|
159
|
+
json_docs="[]"
|
|
160
|
+
else
|
|
161
|
+
json_docs=$(printf '%s\n' "${docs[@]}" | jq -R . | jq -s .)
|
|
162
|
+
fi
|
|
163
|
+
jq -cn \
|
|
164
|
+
--arg feature_dir "$FEATURE_DIR" \
|
|
165
|
+
--argjson docs "$json_docs" \
|
|
166
|
+
'{FEATURE_DIR:$feature_dir,AVAILABLE_DOCS:$docs}'
|
|
167
|
+
else
|
|
168
|
+
if [[ ${#docs[@]} -eq 0 ]]; then
|
|
169
|
+
json_docs="[]"
|
|
170
|
+
else
|
|
171
|
+
json_docs=$(for d in "${docs[@]}"; do printf '"%s",' "$(json_escape "$d")"; done)
|
|
172
|
+
json_docs="[${json_docs%,}]"
|
|
173
|
+
fi
|
|
174
|
+
printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$(json_escape "$FEATURE_DIR")" "$json_docs"
|
|
175
|
+
fi
|
|
176
|
+
else
|
|
177
|
+
# Text output
|
|
178
|
+
echo "FEATURE_DIR:$FEATURE_DIR"
|
|
179
|
+
echo "AVAILABLE_DOCS:"
|
|
180
|
+
|
|
181
|
+
# Show status of each potential document
|
|
182
|
+
check_file "$RESEARCH" "research.md"
|
|
183
|
+
check_file "$DATA_MODEL" "data-model.md"
|
|
184
|
+
check_dir "$CONTRACTS_DIR" "contracts/"
|
|
185
|
+
check_file "$QUICKSTART" "quickstart.md"
|
|
186
|
+
|
|
187
|
+
if $INCLUDE_TASKS; then
|
|
188
|
+
check_file "$TASKS" "tasks.md"
|
|
189
|
+
fi
|
|
190
|
+
fi
|