create-dss-project 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/bin/create-dss-project.js +4 -0
  2. package/lib/index.js +80 -0
  3. package/lib/project-types.js +74 -0
  4. package/lib/prompts.js +42 -0
  5. package/lib/scaffold.js +169 -0
  6. package/package.json +30 -0
  7. package/template/.github/workflows/dashboard-build.yml +27 -0
  8. package/template/.github/workflows/template-lint.yml +71 -0
  9. package/template/CHANGELOG.md +43 -0
  10. package/template/CLAUDE.md +145 -0
  11. package/template/LICENSE +21 -0
  12. package/template/README.md +201 -0
  13. package/template/STATUS.md +34 -0
  14. package/template/context/competitor-snapshot.md +27 -0
  15. package/template/context/market-snapshot.md +32 -0
  16. package/template/context/pipeline-state.md +36 -0
  17. package/template/context/project-state.md +45 -0
  18. package/template/dashboard/CLAUDE.md +36 -0
  19. package/template/dashboard/DEPLOY.md +60 -0
  20. package/template/dashboard/build-data.js +395 -0
  21. package/template/dashboard/competitors.html +143 -0
  22. package/template/dashboard/css/styles.css +143 -0
  23. package/template/dashboard/data/.gitkeep +0 -0
  24. package/template/dashboard/decisions.html +132 -0
  25. package/template/dashboard/index.html +152 -0
  26. package/template/dashboard/js/app.js +59 -0
  27. package/template/dashboard/js/overview.js +50 -0
  28. package/template/dashboard/js/sidebar.js +62 -0
  29. package/template/dashboard/js/tailwind-config.js +52 -0
  30. package/template/dashboard/package-lock.json +351 -0
  31. package/template/dashboard/package.json +17 -0
  32. package/template/dashboard/pipeline.html +149 -0
  33. package/template/dashboard/research.html +215 -0
  34. package/template/dashboard/robots.txt +2 -0
  35. package/template/dashboard/scoring.html +187 -0
  36. package/template/dashboard/timeline.html +165 -0
  37. package/template/dashboard/vercel.json +5 -0
  38. package/template/dashboard/watch.js +57 -0
  39. package/template/data/.gitkeep +0 -0
  40. package/template/discovery/calls/.gitkeep +0 -0
  41. package/template/discovery/outreach/.gitkeep +0 -0
  42. package/template/discovery/prep/.gitkeep +0 -0
  43. package/template/docs/decks/.gitkeep +0 -0
  44. package/template/docs/executive-summary.md +104 -0
  45. package/template/docs/getting-started.md +274 -0
  46. package/template/docs/memos/evidence-grading.md +27 -0
  47. package/template/docs/memos/housekeeping-reference.md +101 -0
  48. package/template/docs/memos/reference-context.md +30 -0
  49. package/template/docs/output/project-activity.md +8 -0
  50. package/template/docs/output/status-blurb.md +4 -0
  51. package/template/docs/output/work-log.md +8 -0
  52. package/template/docs/skill-authoring-guide.md +212 -0
  53. package/template/memory/MEMORY.md +84 -0
  54. package/template/memory/decisions.md +13 -0
  55. package/template/memory/discovery.md +48 -0
  56. package/template/memory/research.md +33 -0
  57. package/template/memory/scoring.md +34 -0
  58. package/template/project.config.example.json +31 -0
  59. package/template/research/competitors/.gitkeep +0 -0
  60. package/template/research/market/.gitkeep +0 -0
  61. package/template/research/technical/.gitkeep +0 -0
  62. package/template/scripts/.gitkeep +0 -0
  63. package/template/scripts/build-cli-template.sh +32 -0
  64. package/template/scripts/health-check.sh +152 -0
  65. package/template/scripts/reset-to-template.sh +115 -0
  66. package/template/scripts/validate-placeholders.sh +47 -0
  67. package/template/skills/compare-options/SKILL.md +97 -0
  68. package/template/skills/critical-reasoning/SKILL.md +107 -0
  69. package/template/skills/decision/SKILL.md +75 -0
  70. package/template/skills/enrich-entity/SKILL.md +107 -0
  71. package/template/skills/health-check/SKILL.md +144 -0
  72. package/template/skills/onboard/SKILL.md +434 -0
  73. package/template/skills/outreach-sequence/SKILL.md +79 -0
  74. package/template/skills/pipeline-update/SKILL.md +90 -0
  75. package/template/skills/process-call/SKILL.md +96 -0
  76. package/template/skills/rebuild-snapshots/SKILL.md +88 -0
  77. package/template/skills/session-end/SKILL.md +120 -0
  78. package/template/skills/session-start/SKILL.md +93 -0
  79. package/template/skills/synthesise/SKILL.md +108 -0
  80. package/template/skills/weekly-report/SKILL.md +79 -0
  81. package/template/templates/call-notes.md +67 -0
  82. package/template/templates/call-prep.md +65 -0
  83. package/template/templates/entity-teardown.md +58 -0
@@ -0,0 +1,212 @@
1
+ # Skill Authoring Guide
2
+
3
+ How to create and contribute new skills for the DS Strategy Stack.
4
+
5
+ ---
6
+
7
+ ## SKILL.md Frontmatter
8
+
9
+ Every skill lives in `skills/{skill-name}/SKILL.md`. The file **must** begin with YAML frontmatter containing at least two required fields:
10
+
11
+ ```yaml
12
+ ---
13
+ name: my-skill-name
14
+ description: A one-sentence summary of what this skill does and when to use it.
15
+ ---
16
+ ```
17
+
18
+ - **name** (required): Lowercase, hyphenated identifier. Must match the directory name.
19
+ - **description** (required): Plain text, one to two sentences. Shown in skill listings and help output.
20
+
21
+ ## Directory Structure
22
+
23
+ ```
24
+ skills/
25
+ my-skill-name/
26
+ SKILL.md # The skill definition (required)
27
+ ```
28
+
29
+ Each skill gets its own directory under `skills/`. The directory name must match the `name` field in the frontmatter. Keep one skill per directory — do not bundle multiple skills together.
30
+
31
+ ## Skill Types
32
+
33
+ Skills fall into two categories:
34
+
35
+ ### Rigid Skills
36
+
37
+ Rigid skills execute every step in order. The user (or Claude) must not skip steps or reorder them. Use rigid skills for processes where completeness matters — audits, checklists, onboarding flows.
38
+
39
+ **Example**: `health-check` runs every check regardless of context.
40
+
41
+ When writing a rigid skill, number each step clearly and include a note at the top:
42
+
43
+ ```markdown
44
+ > **Type: Rigid** — Execute all steps in order. Do not skip or reorder.
45
+ ```
46
+
47
+ ### Flexible Skills
48
+
49
+ Flexible skills provide a framework that adapts to context. Steps can be skipped, reordered, or expanded based on what the project needs right now. Use flexible skills for creative or analytical work — research synthesis, competitive analysis, decision-making.
50
+
51
+ **Example**: `synthesise` may focus on different research areas depending on what data is available.
52
+
53
+ When writing a flexible skill, note which steps are optional:
54
+
55
+ ```markdown
56
+ > **Type: Flexible** — Adapt steps to the current context. Steps marked (optional) may be skipped.
57
+ ```
58
+
59
+ ## Memory File Interactions
60
+
61
+ Skills frequently read from and write to memory files. Document these interactions clearly so that users and other skills know what to expect.
62
+
63
+ ### Reading Memory
64
+
65
+ If your skill reads from memory files, list them at the top of the skill:
66
+
67
+ ```markdown
68
+ ## Inputs
69
+ - `memory/MEMORY.md` — current project state and priorities
70
+ - `memory/research.md` — entity capability map and research findings
71
+ ```
72
+
73
+ ### Writing to Memory
74
+
75
+ If your skill updates memory files, specify exactly what it changes:
76
+
77
+ ```markdown
78
+ ## Outputs
79
+ - Updates `memory/MEMORY.md` § Current Priority
80
+ - Appends to `memory/discovery.md` § Discovery Log
81
+ ```
82
+
83
+ Always use the **append or update** pattern — never overwrite an entire memory file. Other skills depend on sections you did not write.
84
+
85
+ ## Evidence Grading System
86
+
87
+ All factual claims in research and discovery files must carry an evidence grade. When your skill produces or processes factual content, enforce these tags:
88
+
89
+ | Tag | Meaning | When to use |
90
+ |-----|---------|-------------|
91
+ | `[CONFIRMED]` | Verified from a primary source | Official docs, direct quotes, first-party data |
92
+ | `[SECONDARY]` | From a credible but indirect source | Industry reports, reputable journalism |
93
+ | `[INFERENCE]` | Logically derived from confirmed facts | Reasonable conclusions from known data |
94
+ | `[ASSUMPTION]` | Unverified belief or estimate | Hypotheses, rough estimates, hearsay |
95
+
96
+ If your skill generates research output, include a reminder to tag every factual claim. If your skill consumes research, validate that evidence grades are present and flag ungraded claims.
97
+
98
+ ## Adding Dashboard Data Extraction
99
+
100
+ If your skill produces structured data that should appear on the dashboard, you need to extend the build pipeline.
101
+
102
+ ### Step 1: Define your data shape
103
+
104
+ Decide what JSON structure your data should produce. For example:
105
+
106
+ ```json
107
+ {
108
+ "lastUpdated": "2026-03-26",
109
+ "items": [
110
+ { "name": "Example", "status": "active" }
111
+ ]
112
+ }
113
+ ```
114
+
115
+ ### Step 2: Extend build-data.js
116
+
117
+ Open `dashboard/build-data.js` and add a new extraction function:
118
+
119
+ ```javascript
120
+ // Extract data for my-skill
121
+ function extractMySkillData() {
122
+ // Read source files from research/, memory/, or discovery/
123
+ // Parse and structure the data
124
+ // Write to dashboard/data/my-skill.json
125
+ }
126
+ ```
127
+
128
+ Call your function from the main build sequence at the bottom of the file.
129
+
130
+ ### Step 3: Create a dashboard view (optional)
131
+
132
+ If your data warrants its own page, create a new HTML file in `dashboard/` following the patterns in existing pages like `competitors.html` or `pipeline.html`.
133
+
134
+ ## Testing Your Skill
135
+
136
+ After creating or modifying a skill:
137
+
138
+ 1. **Run the health check** to catch structural issues:
139
+ ```bash
140
+ scripts/health-check.sh
141
+ ```
142
+
143
+ 2. **Validate placeholders** if your skill references template tokens:
144
+ ```bash
145
+ scripts/validate-placeholders.sh
146
+ ```
147
+
148
+ 3. **Check frontmatter** manually — ensure `name` and `description` are present and the name matches your directory.
149
+
150
+ 4. **Test the skill end-to-end** by invoking it in a Claude session and verifying:
151
+ - All listed inputs are read
152
+ - All listed outputs are written correctly
153
+ - Memory files are updated (not overwritten)
154
+ - Evidence grades are applied where relevant
155
+
156
+ ## Example Skill Template
157
+
158
+ Below is a minimal skill you can copy and adapt:
159
+
160
+ ```markdown
161
+ ---
162
+ name: example-skill
163
+ description: A brief description of what this skill does and when it should be invoked.
164
+ ---
165
+
166
+ # Example Skill
167
+
168
+ > **Type: Flexible** — Adapt steps to the current context.
169
+
170
+ ## Inputs
171
+ - `memory/MEMORY.md` — current project state
172
+
173
+ ## Outputs
174
+ - Updates `memory/MEMORY.md` § Current Priority
175
+
176
+ ---
177
+
178
+ ## Step 1 — Assess Current State
179
+
180
+ Read `memory/MEMORY.md` and summarise the current project phase and priorities.
181
+
182
+ ## Step 2 — Perform Analysis
183
+
184
+ <!-- Your skill logic here -->
185
+
186
+ ## Step 3 — Update Memory (optional)
187
+
188
+ If the analysis produced new insights, update `memory/MEMORY.md` with:
189
+ - Any changed priorities
190
+ - New findings tagged with evidence grades
191
+ ```
192
+
193
+ ## Australian English Requirement
194
+
195
+ All content in this project — skill definitions, comments, documentation, and code comments — must use Australian English spelling conventions:
196
+
197
+ - **-ise** not -ize (e.g. organise, prioritise, recognise, synthesise)
198
+ - **-our** not -or (e.g. colour, behaviour, honour)
199
+ - **-re** not -er (e.g. centre, theatre)
200
+ - **analyse** not analyze
201
+
202
+ This applies to skill descriptions, step text, comments in code, and any generated output.
203
+
204
+ ## Checklist Before Submitting
205
+
206
+ - [ ] `SKILL.md` has valid frontmatter with `name` and `description`
207
+ - [ ] Directory name matches the `name` field
208
+ - [ ] Skill type (Rigid or Flexible) is clearly stated
209
+ - [ ] Inputs and outputs are documented
210
+ - [ ] Evidence grading guidance is included (if the skill handles factual content)
211
+ - [ ] Tested with `scripts/health-check.sh`
212
+ - [ ] Australian English spelling used throughout
@@ -0,0 +1,84 @@
1
+ # MEMORY.md — {{PROJECT_NAME}}
2
+
3
+ **Project**: {{ONE_LINE_DESCRIPTION}}
4
+ **Goal**: {{GOAL}}
5
+ **Team**: {{TEAM}}
6
+ **Current phase**: Phase 1 — Setup
7
+ **Last updated**: {{DATE}}
8
+
9
+ ---
10
+
11
+ ## Project State
12
+
13
+ - **Research**: Not started.
14
+ - **Leading hypothesis**: {{STRATEGIC_HYPOTHESIS}}
15
+ - **Discovery**: Not started.
16
+ - **Build/Prototype**: Not started.
17
+
18
+ ## Current Priority
19
+
20
+ <!-- Update each session with the 1–2 most important things to focus on -->
21
+
22
+ ---
23
+
24
+ ## Memory File Index (Layer 2 — load when topic is active)
25
+
26
+ | File | Contents | Load when |
27
+ |------|----------|-----------|
28
+ | `memory/research.md` | Competitor map, market sizing, entity list, technical findings | Competitor/market questions |
29
+ | `memory/discovery.md` | Kill conditions, call log, WTP signals, pain rankings | Discovery/call work |
30
+ | `memory/decisions.md` | Strategic decisions with rationale | Questioning the strategy |
31
+ | `memory/scoring.md` | Option scoring, recommended strategy | Hypothesis/positioning work |
32
+
33
+ ---
34
+
35
+ ## Key Facts
36
+
37
+ <!-- Add 8–12 facts that any session needs to know. Include:
38
+ - Target customer description
39
+ - Product description
40
+ - Market sizing headline numbers
41
+ - Key entities in pipeline
42
+ - Price target or revenue model
43
+ - Key architectural or strategic constraints
44
+ - Competitive white space
45
+ - Timeline or convergence window
46
+ -->
47
+
48
+ ---
49
+
50
+ ## Key Decisions (one-liners — full rationale in `memory/decisions.md`)
51
+
52
+ <!-- Add numbered one-liner decisions as they're made. Example:
53
+ 1. SaaS only — no managed services (wrong unit economics)
54
+ 2. API-first — no proprietary SDKs (switching cost concern)
55
+ -->
56
+
57
+ ---
58
+
59
+ ## Kill Conditions
60
+
61
+ <!-- Define 4–6 falsifiable thresholds. If crossed, the project should stop or pivot. -->
62
+
63
+ | # | Condition | Status |
64
+ |---|-----------|--------|
65
+ | 1 | | UNTESTED |
66
+ | 2 | | UNTESTED |
67
+ | 3 | | UNTESTED |
68
+ | 4 | | UNTESTED |
69
+
70
+ ---
71
+
72
+ ## Important File Paths
73
+
74
+ | Asset | Path |
75
+ |-------|------|
76
+ | Executive summary | `docs/executive-summary.md` |
77
+ | Status board | `STATUS.md` |
78
+ | Option scoring | `memory/scoring.md` |
79
+ | Competitor synthesis | `research/competitors/` |
80
+ | Market sizing | `research/market/` |
81
+ | Target entities (CSV) | `{{PIPELINE_SOURCE_OF_TRUTH}}` |
82
+ | Reference context | `docs/memos/reference-context.md` |
83
+ | Housekeeping rules | `docs/memos/housekeeping-reference.md` |
84
+ | Status blurb | `docs/output/status-blurb.md` |
@@ -0,0 +1,13 @@
1
+ # Strategic Decisions — {{PROJECT_NAME}}
2
+
3
+ Full rationale for each decision. One-liners in `memory/MEMORY.md`.
4
+
5
+ ---
6
+
7
+ | # | Decision | Rationale | Date | Reversible? |
8
+ |---|----------|-----------|------|-------------|
9
+
10
+ <!-- Example:
11
+ | 1 | SaaS only — no managed services | Unit economics don't support services at this stage. $X CAC with services vs $Y without. Revisit if discovery shows services are table stakes. | 2026-03-01 | Yes (add later) |
12
+ | 2 | API-first, no proprietary SDKs | Customer interviews showed SDK fatigue across all segments. S2S/webhooks are sufficient for MVP scope. | 2026-03-05 | Partially (SDK can be added; hard to remove once shipped) |
13
+ -->
@@ -0,0 +1,48 @@
1
+ # Discovery — {{PROJECT_NAME}}
2
+
3
+ > **OPTIONAL MODULE** — Include this file if your project involves customer discovery, stakeholder interviews, or external validation. Omit for pure research or internal strategy projects.
4
+
5
+ ---
6
+
7
+ ## Pain Point Rankings
8
+
9
+ <!-- Update after every discovery call. Rank by frequency and intensity across calls. -->
10
+
11
+ | Rank | Pain Point | Mentions | Intensity (1–5) | Evidence Grade |
12
+ |------|-----------|----------|-----------------|---------------|
13
+
14
+ ---
15
+
16
+ ## WTP (Willingness to Pay) Signals
17
+
18
+ | {{ENTITY_TYPE}} | Signal | Amount/Range | Context | Evidence Grade |
19
+ |-----------------|--------|-------------|---------|---------------|
20
+
21
+ ---
22
+
23
+ ## Kill Condition Tracker (Detailed)
24
+
25
+ <!-- Detailed tracking with evidence per kill condition. Summary lives in MEMORY.md. -->
26
+
27
+ ### KC1: {{CONDITION}}
28
+ - **Status**: UNTESTED
29
+ - **Evidence**:
30
+
31
+ ### KC2: {{CONDITION}}
32
+ - **Status**: UNTESTED
33
+ - **Evidence**:
34
+
35
+ ### KC3: {{CONDITION}}
36
+ - **Status**: UNTESTED
37
+ - **Evidence**:
38
+
39
+ ### KC4: {{CONDITION}}
40
+ - **Status**: UNTESTED
41
+ - **Evidence**:
42
+
43
+ ---
44
+
45
+ ## Outreach Log
46
+
47
+ | Date | {{ENTITY_TYPE}} | Channel | Action | Result | Next Step |
48
+ |------|-----------------|---------|--------|--------|-----------|
@@ -0,0 +1,33 @@
1
+ # Research — {{PROJECT_NAME}}
2
+
3
+ ## Entity Capability Map
4
+
5
+ <!-- Add columns relevant to your domain. Examples: Category, Cost, Pricing Model, Lock-In, Sentiment -->
6
+
7
+ | Entity | Category | Key Strength | Key Weakness | Relevance |
8
+ |--------|----------|-------------|-------------|-----------|
9
+
10
+ ---
11
+
12
+ ## Market Sizing Summary
13
+
14
+ | Metric | Value | Source | Evidence Grade |
15
+ |--------|-------|--------|---------------|
16
+ | TAM | | | |
17
+ | SAM | | | |
18
+ | SOM (Y1) | | | |
19
+
20
+ ---
21
+
22
+ ## Target Entity List
23
+
24
+ <!-- Track the {{ENTITY_TYPE_PLURAL}} you're actively pursuing or researching -->
25
+
26
+ | # | Name | Tier | Status | Notes |
27
+ |---|------|------|--------|-------|
28
+
29
+ ---
30
+
31
+ ## Technical Findings
32
+
33
+ <!-- Key technical feasibility findings, architectural decisions, or platform constraints -->
@@ -0,0 +1,34 @@
1
+ # Option Scoring — {{PROJECT_NAME}}
2
+
3
+ ## Options Reference
4
+
5
+ <!-- List the strategic options, entry angles, or approaches being evaluated -->
6
+
7
+ | Code | Name | Description |
8
+ |------|------|-------------|
9
+
10
+ ---
11
+
12
+ ## Scoring Matrix
13
+
14
+ <!-- Common dimensions: White Space, Urgency, Feasibility, Defensibility, Revenue Potential, Pipeline/Demand.
15
+ Each scored 1–5. Adapt dimensions to your project. -->
16
+
17
+ | Option | {{DIM_1}} | {{DIM_2}} | {{DIM_3}} | {{DIM_4}} | {{DIM_5}} | Total | Rank |
18
+ |--------|-----------|-----------|-----------|-----------|-----------|-------|------|
19
+
20
+ **Scoring guide**:
21
+ - **5** = Strong structural advantage or high confidence
22
+ - **3** = Partial, with a credible path to strengthening
23
+ - **1** = Absent or high uncertainty
24
+
25
+ ---
26
+
27
+ ## Recommended Strategy
28
+
29
+ <!-- After scoring, document the recommended approach and rationale -->
30
+
31
+ **Lead with**:
32
+ **Rationale**:
33
+ **Key risks**:
34
+ **Fallback if lead option fails**:
@@ -0,0 +1,31 @@
1
+ {
2
+ "templateVersion": "1.0.0",
3
+ "templateSource": "github.com/DiffTheEnder/DSS-Claude-Stack",
4
+ "projectType": "",
5
+ "projectName": "",
6
+ "projectSlug": "",
7
+ "oneLineDescription": "",
8
+ "goal": "",
9
+ "team": "",
10
+ "scope": "",
11
+ "outOfScope": "",
12
+ "strategicHypothesis": "",
13
+ "icpDescription": "",
14
+ "entityType": "",
15
+ "entityTypePlural": "",
16
+ "pipelineSourceOfTruth": "data/entities.csv",
17
+ "dashboardUrl": "",
18
+ "modules": {
19
+ "discovery": true,
20
+ "pipeline": true,
21
+ "dashboard": true
22
+ },
23
+ "scoringDimensions": [
24
+ "White Space",
25
+ "Urgency",
26
+ "Feasibility",
27
+ "Defensibility",
28
+ "Revenue Potential"
29
+ ],
30
+ "killConditions": []
31
+ }
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+ # Copies template files into cli/template/ for npm publishing.
3
+ # Run from repo root or via cli/package.json prepublishOnly.
4
+
5
+ set -e
6
+
7
+ REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
8
+ TEMPLATE_DIR="$REPO_ROOT/cli/template"
9
+
10
+ echo "Building CLI template from repo..."
11
+
12
+ # Clean previous build
13
+ rm -rf "$TEMPLATE_DIR"
14
+ mkdir -p "$TEMPLATE_DIR"
15
+
16
+ # Copy everything except excluded paths
17
+ rsync -a \
18
+ --exclude='.git' \
19
+ --exclude='node_modules' \
20
+ --exclude='.DS_Store' \
21
+ --exclude='cli' \
22
+ --exclude='.next' \
23
+ --exclude='.claude' \
24
+ --exclude='dashboard/data/*.json' \
25
+ --exclude='dashboard/screenshot.png' \
26
+ --exclude='project.config.json' \
27
+ --exclude='CONTRIBUTING.md' \
28
+ --exclude='.github/ISSUE_TEMPLATE' \
29
+ --exclude='.github/pull_request_template.md' \
30
+ "$REPO_ROOT/" "$TEMPLATE_DIR/"
31
+
32
+ echo "✓ Template built at cli/template/"
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env bash
2
+ # health-check.sh
3
+ # Lightweight CLI health check for the DS Strategy Stack.
4
+ # Mirrors the checks in skills/health-check/SKILL.md.
5
+ # Uses Australian English throughout.
6
+
7
+ set -euo pipefail
8
+
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
11
+
12
+ PASSES=0
13
+ WARNS=0
14
+ FAILS=0
15
+
16
+ pass() {
17
+ echo " [PASS] $1"
18
+ PASSES=$((PASSES + 1))
19
+ }
20
+
21
+ warn() {
22
+ echo " [WARN] $1"
23
+ WARNS=$((WARNS + 1))
24
+ }
25
+
26
+ fail() {
27
+ echo " [FAIL] $1"
28
+ FAILS=$((FAILS + 1))
29
+ }
30
+
31
+ echo "=== Project Health Check ==="
32
+ echo "Project root: $PROJECT_ROOT"
33
+ echo ""
34
+
35
+ # -----------------------------------------------
36
+ # Check 1: Unreplaced placeholders
37
+ # -----------------------------------------------
38
+ echo "--- Check 1: Unreplaced Placeholders ---"
39
+ if "$SCRIPT_DIR/validate-placeholders.sh" > /dev/null 2>&1; then
40
+ pass "No unreplaced placeholders found."
41
+ else
42
+ fail "Unreplaced {{PLACEHOLDER}} tokens remain. Run: scripts/validate-placeholders.sh for details."
43
+ fi
44
+ echo ""
45
+
46
+ # -----------------------------------------------
47
+ # Check 2: project.config.json exists
48
+ # -----------------------------------------------
49
+ echo "--- Check 2: Project Configuration ---"
50
+ if [ -f "$PROJECT_ROOT/project.config.json" ]; then
51
+ pass "project.config.json exists."
52
+ else
53
+ warn "project.config.json is missing. Onboarding may be incomplete."
54
+ fi
55
+ echo ""
56
+
57
+ # -----------------------------------------------
58
+ # Check 3: Dashboard data freshness
59
+ # -----------------------------------------------
60
+ echo "--- Check 3: Dashboard Data Freshness ---"
61
+
62
+ # Helper: get file modification timestamp (cross-platform)
63
+ file_mtime() {
64
+ if [[ "$(uname)" == "Darwin" ]]; then
65
+ stat -f %m "$1" 2>/dev/null || echo 0
66
+ else
67
+ stat -c %Y "$1" 2>/dev/null || echo 0
68
+ fi
69
+ }
70
+
71
+ STALE_COUNT=0
72
+ # Map source files to their corresponding dashboard JSON
73
+ declare -a SOURCES=("memory/research.md" "docs/executive-summary.md" "memory/MEMORY.md")
74
+ declare -a JSONS=("dashboard/data/competitors.json" "dashboard/data/overview.json" "dashboard/data/entities.json")
75
+
76
+ for i in "${!SOURCES[@]}"; do
77
+ SRC="$PROJECT_ROOT/${SOURCES[$i]}"
78
+ JSON="$PROJECT_ROOT/${JSONS[$i]}"
79
+
80
+ if [ -f "$SRC" ] && [ -f "$JSON" ]; then
81
+ SRC_TIME=$(file_mtime "$SRC")
82
+ JSON_TIME=$(file_mtime "$JSON")
83
+ if [ "$SRC_TIME" -gt "$JSON_TIME" ]; then
84
+ warn "Dashboard data stale: ${SOURCES[$i]} is newer than ${JSONS[$i]}."
85
+ STALE_COUNT=$((STALE_COUNT + 1))
86
+ fi
87
+ fi
88
+ done
89
+
90
+ if [ "$STALE_COUNT" -eq 0 ]; then
91
+ pass "Dashboard data appears up to date (or source/JSON files not yet created)."
92
+ fi
93
+ echo ""
94
+
95
+ # -----------------------------------------------
96
+ # Check 4: Versioned files (_v2, _old, _backup)
97
+ # -----------------------------------------------
98
+ echo "--- Check 4: Versioned / Backup Files ---"
99
+ VERSIONED=$(find "$PROJECT_ROOT" \
100
+ \( -name "*_v[0-9]*" -o -name "*_old*" -o -name "*_backup*" \) \
101
+ -not -path "*/node_modules/*" \
102
+ -not -path "*/.git/*" 2>/dev/null || true)
103
+
104
+ if [ -z "$VERSIONED" ]; then
105
+ pass "No versioned or backup files found."
106
+ else
107
+ VCOUNT=$(echo "$VERSIONED" | wc -l | tr -d ' ')
108
+ warn "$VCOUNT versioned/backup file(s) found. Keep only the latest version."
109
+ echo "$VERSIONED" | while read -r f; do echo " -> $f"; done
110
+ fi
111
+ echo ""
112
+
113
+ # -----------------------------------------------
114
+ # Check 5: MEMORY.md line count
115
+ # -----------------------------------------------
116
+ echo "--- Check 5: MEMORY.md Size ---"
117
+ MEMORY_FILE="$PROJECT_ROOT/memory/MEMORY.md"
118
+ if [ -f "$MEMORY_FILE" ]; then
119
+ LINE_COUNT=$(wc -l < "$MEMORY_FILE" | tr -d ' ')
120
+ if [ "$LINE_COUNT" -gt 300 ]; then
121
+ fail "MEMORY.md is $LINE_COUNT lines (limit 300). Must prune immediately."
122
+ elif [ "$LINE_COUNT" -gt 200 ]; then
123
+ warn "MEMORY.md is $LINE_COUNT lines (recommended limit 200). Consider pruning."
124
+ else
125
+ pass "MEMORY.md is $LINE_COUNT lines. Within acceptable range."
126
+ fi
127
+ else
128
+ warn "memory/MEMORY.md does not exist."
129
+ fi
130
+ echo ""
131
+
132
+ # -----------------------------------------------
133
+ # Summary
134
+ # -----------------------------------------------
135
+ echo "==========================================="
136
+ echo " Health Check Summary"
137
+ echo "==========================================="
138
+ echo " Passed : $PASSES"
139
+ echo " Warnings: $WARNS"
140
+ echo " Failures: $FAILS"
141
+ echo ""
142
+
143
+ if [ "$FAILS" -gt 0 ]; then
144
+ echo " Overall: FAIL — $FAILS critical issue(s) require attention."
145
+ exit 1
146
+ elif [ "$WARNS" -gt 0 ]; then
147
+ echo " Overall: WARN — No critical issues, but $WARNS warning(s) to address."
148
+ exit 0
149
+ else
150
+ echo " Overall: PASS — Project is healthy."
151
+ exit 0
152
+ fi