@drafthq/draft 2.8.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +9 -3
- package/bin/README.md +13 -0
- package/cli/src/installer.js +11 -2
- package/core/methodology.md +17 -18
- package/core/shared/condensation.md +1 -1
- package/core/shared/draft-context-loading.md +4 -2
- package/core/shared/graph-query.md +4 -3
- package/core/templates/ai-context.md +1 -0
- package/core/templates/ai-profile.md +1 -0
- package/core/templates/architecture.md +1 -0
- package/core/templates/dependency-graph.md +2 -2
- package/core/templates/discovery.md +1 -0
- package/core/templates/guardrails.md +1 -0
- package/core/templates/hld.md +1 -0
- package/core/templates/lld.md +1 -0
- package/core/templates/plan.md +1 -0
- package/core/templates/product.md +1 -0
- package/core/templates/rca.md +1 -0
- package/core/templates/root-architecture.md +3 -3
- package/core/templates/root-product.md +2 -2
- package/core/templates/root-tech-stack.md +2 -2
- package/core/templates/service-index.md +3 -3
- package/core/templates/spec.md +1 -0
- package/core/templates/tech-matrix.md +2 -2
- package/core/templates/tech-stack.md +1 -0
- package/core/templates/workflow.md +1 -0
- package/integrations/agents/AGENTS.md +134 -918
- package/integrations/copilot/.github/copilot-instructions.md +134 -918
- package/integrations/copilot/.github/copilot-instructions.md.7iDz8X +91 -0
- package/integrations/copilot/.github/copilot-instructions.md.DoBdtd +91 -0
- package/integrations/copilot/.github/copilot-instructions.md.McGoBW +122 -0
- package/integrations/copilot/.github/copilot-instructions.md.VsPyLB +91 -0
- package/integrations/copilot/.github/copilot-instructions.md.XAVr7D +91 -0
- package/integrations/copilot/.github/copilot-instructions.md.YoFVFa +91 -0
- package/integrations/copilot/.github/copilot-instructions.md.a9DeW0 +91 -0
- package/integrations/copilot/.github/copilot-instructions.md.oxQs3B +91 -0
- package/integrations/copilot/.github/copilot-instructions.md.ww33Ly +91 -0
- package/package.json +1 -1
- package/scripts/lib.sh +4 -1
- package/scripts/tools/graph-init.sh +187 -0
- package/scripts/tools/graph-snapshot.sh +6 -1
- package/scripts/tools/okf-bundle.sh +141 -0
- package/scripts/tools/okf-check.sh +137 -0
- package/scripts/tools/okf-emit.sh +161 -0
- package/scripts/tools/skill-caps.conf +0 -1
- package/skills/GRAPH.md +7 -10
- package/skills/bughunt/SKILL.md +13 -0
- package/skills/discover/SKILL.md +2 -4
- package/skills/draft/SKILL.md +2 -2
- package/skills/draft/intent-mapping.md +3 -2
- package/skills/graph/SKILL.md +3 -3
- package/skills/init/SKILL.md +58 -19
- package/skills/init/references/architecture-spec.md +5 -5
- package/skills/index/SKILL.md +0 -848
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# okf-check.sh — validate a directory against the Open Knowledge Format v0.1 spec.
|
|
3
|
+
#
|
|
4
|
+
# Implements the §9 conformance criteria of OKF v0.1
|
|
5
|
+
# (https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md):
|
|
6
|
+
#
|
|
7
|
+
# §9.1 Every non-reserved .md file has a parseable YAML frontmatter block.
|
|
8
|
+
# §9.2 Every such frontmatter block has a non-empty `type` field.
|
|
9
|
+
# §9.3 Reserved files follow their structure when present:
|
|
10
|
+
# index.md (§6) — contains NO frontmatter, EXCEPT the bundle-root
|
|
11
|
+
# index.md MAY carry frontmatter holding only
|
|
12
|
+
# `okf_version` (§11).
|
|
13
|
+
# log.md (§7) — `## ` date headings MUST be ISO 8601 (YYYY-MM-DD).
|
|
14
|
+
#
|
|
15
|
+
# Consumers are required to be permissive, so this checker only enforces the
|
|
16
|
+
# three hard rules above; everything else in the spec is soft guidance.
|
|
17
|
+
#
|
|
18
|
+
# Usage: scripts/tools/okf-check.sh [--dir DIR] [--quiet]
|
|
19
|
+
# Exit codes: 0 conformant, 1 violations found, 2 dir missing.
|
|
20
|
+
set -euo pipefail
|
|
21
|
+
|
|
22
|
+
DIR="draft"
|
|
23
|
+
QUIET=0
|
|
24
|
+
|
|
25
|
+
usage() {
|
|
26
|
+
cat <<'EOF'
|
|
27
|
+
okf-check.sh — validate a directory against Open Knowledge Format v0.1 (§9).
|
|
28
|
+
|
|
29
|
+
Usage:
|
|
30
|
+
scripts/tools/okf-check.sh [--dir DIR] [--quiet]
|
|
31
|
+
|
|
32
|
+
Flags:
|
|
33
|
+
--dir DIR Bundle root to validate (default: draft).
|
|
34
|
+
--quiet Print only the summary line, not per-file violations.
|
|
35
|
+
--help Show this help.
|
|
36
|
+
|
|
37
|
+
Exit 0 when conformant, 1 when violations are found, 2 when DIR is absent.
|
|
38
|
+
EOF
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
while [[ $# -gt 0 ]]; do
|
|
42
|
+
case "$1" in
|
|
43
|
+
--dir) DIR="$2"; shift 2;;
|
|
44
|
+
--quiet) QUIET=1; shift;;
|
|
45
|
+
--help|-h) usage; exit 0;;
|
|
46
|
+
-*) echo "Unknown flag: $1" >&2; usage >&2; exit 1;;
|
|
47
|
+
*) echo "Unexpected arg: $1" >&2; usage >&2; exit 1;;
|
|
48
|
+
esac
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
[[ -d "$DIR" ]] || { echo "ERROR: --dir '$DIR' is not a directory" >&2; exit 2; }
|
|
52
|
+
DIR="${DIR%/}"
|
|
53
|
+
|
|
54
|
+
# fm_scan FILE -> "STATUS|TYPE|KEYS" (pipe-delimited; '|' is not IFS-whitespace,
|
|
55
|
+
# so empty TYPE/KEYS fields survive `read` instead of collapsing).
|
|
56
|
+
# STATUS: nofm (no frontmatter) | ok (closed block) | unterminated
|
|
57
|
+
# TYPE: value of the top-level `type:` key, if any
|
|
58
|
+
# KEYS: comma-separated top-level frontmatter keys
|
|
59
|
+
fm_scan() {
|
|
60
|
+
awk '
|
|
61
|
+
NR==1 { if ($0 != "---") { print "nofm||"; exit } ; inblock=1; next }
|
|
62
|
+
inblock && /^---[[:space:]]*$/ { print "ok|" type "|" keys; closed=1; exit }
|
|
63
|
+
inblock {
|
|
64
|
+
if (match($0, /^[A-Za-z_][A-Za-z0-9_]*:/)) {
|
|
65
|
+
k = substr($0, 1, RLENGTH-1)
|
|
66
|
+
keys = keys (keys=="" ? "" : ",") k
|
|
67
|
+
if (k == "type") {
|
|
68
|
+
v = substr($0, RLENGTH+1)
|
|
69
|
+
gsub(/^[ \t]+|[ \t]+$/, "", v)
|
|
70
|
+
gsub(/^"|"$/, "", v)
|
|
71
|
+
type = v
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
next
|
|
75
|
+
}
|
|
76
|
+
END { if (inblock && !closed) print "unterminated|" type "|" keys }
|
|
77
|
+
' "$1"
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
violations=0
|
|
81
|
+
concepts=0
|
|
82
|
+
reserved=0
|
|
83
|
+
|
|
84
|
+
report() { # relpath message
|
|
85
|
+
violations=$((violations + 1))
|
|
86
|
+
[[ "$QUIET" == "1" ]] || echo "FAIL $1: $2" >&2
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
while IFS= read -r -d '' file; do
|
|
90
|
+
rel="${file#"$DIR"/}"
|
|
91
|
+
base="$(basename "$file")"
|
|
92
|
+
|
|
93
|
+
case "$base" in
|
|
94
|
+
index.md)
|
|
95
|
+
reserved=$((reserved + 1))
|
|
96
|
+
IFS='|' read -r status _ keys < <(fm_scan "$file")
|
|
97
|
+
if [[ "$status" != "nofm" ]]; then
|
|
98
|
+
if [[ "$rel" == "index.md" ]]; then
|
|
99
|
+
# Bundle-root index.md: frontmatter allowed, but only okf_version (§11).
|
|
100
|
+
IFS=',' read -ra ks <<< "$keys"
|
|
101
|
+
for k in "${ks[@]}"; do
|
|
102
|
+
[[ -z "$k" || "$k" == "okf_version" ]] && continue
|
|
103
|
+
report "$rel" "root index.md frontmatter may only hold 'okf_version' (§11); found '$k'"
|
|
104
|
+
done
|
|
105
|
+
else
|
|
106
|
+
report "$rel" "index.md must not contain frontmatter (§6)"
|
|
107
|
+
fi
|
|
108
|
+
fi
|
|
109
|
+
;;
|
|
110
|
+
log.md)
|
|
111
|
+
reserved=$((reserved + 1))
|
|
112
|
+
while IFS= read -r h; do
|
|
113
|
+
if ! [[ "$h" =~ ^##[[:space:]]+[0-9]{4}-[0-9]{2}-[0-9]{2} ]]; then
|
|
114
|
+
report "$rel" "log.md date heading not ISO 8601 (§7): '$h'"
|
|
115
|
+
fi
|
|
116
|
+
done < <(grep -E '^## ' "$file" 2>/dev/null || true)
|
|
117
|
+
;;
|
|
118
|
+
*)
|
|
119
|
+
concepts=$((concepts + 1))
|
|
120
|
+
IFS='|' read -r status type _ < <(fm_scan "$file")
|
|
121
|
+
case "$status" in
|
|
122
|
+
nofm) report "$rel" "missing YAML frontmatter block (§9.1)";;
|
|
123
|
+
unterminated) report "$rel" "unterminated frontmatter block — no closing '---' (§9.1)";;
|
|
124
|
+
ok)
|
|
125
|
+
[[ -n "$type" ]] || report "$rel" "frontmatter missing required non-empty 'type' (§9.2)"
|
|
126
|
+
;;
|
|
127
|
+
esac
|
|
128
|
+
;;
|
|
129
|
+
esac
|
|
130
|
+
done < <(find "$DIR" -type f -name '*.md' -print0 | sort -z)
|
|
131
|
+
|
|
132
|
+
if [[ "$violations" -eq 0 ]]; then
|
|
133
|
+
echo "OKF v0.1 conformant — $concepts concept file(s), $reserved reserved file(s), 0 violations. ($DIR)"
|
|
134
|
+
exit 0
|
|
135
|
+
fi
|
|
136
|
+
echo "OKF v0.1 NON-CONFORMANT — $violations violation(s) across $concepts concept + $reserved reserved file(s). ($DIR)" >&2
|
|
137
|
+
exit 1
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# okf-emit.sh — emit an Open Knowledge Format (OKF) bundle from a graph snapshot.
|
|
3
|
+
#
|
|
4
|
+
# OKF is an open, vendor-neutral spec (Google Cloud): a directory of markdown
|
|
5
|
+
# files with YAML frontmatter, one file per concept, where the file path is the
|
|
6
|
+
# concept's identity and concepts cross-link with normal markdown links. The
|
|
7
|
+
# only required frontmatter field is `type`. This makes Draft's knowledge graph
|
|
8
|
+
# portable — consumable by any OKF reader (visualizers, catalogs, other agents).
|
|
9
|
+
# https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing
|
|
10
|
+
#
|
|
11
|
+
# Reads a graph snapshot's architecture.json and writes a conformant bundle:
|
|
12
|
+
# index.md type: Repository — bundle root + progressive disclosure
|
|
13
|
+
# modules/<slug>.md type: Module — one concept per package, cross-linked
|
|
14
|
+
#
|
|
15
|
+
# Degrades gracefully: with no packages/boundaries in the snapshot it still emits
|
|
16
|
+
# index.md (counts, languages, hotspots) and an empty modules/ directory.
|
|
17
|
+
#
|
|
18
|
+
# Usage: scripts/tools/okf-emit.sh [--repo DIR] [--snapshot DIR] [--out DIR]
|
|
19
|
+
# Exit codes: 0 OK, 1 invocation error, 2 snapshot/architecture.json unavailable.
|
|
20
|
+
set -euo pipefail
|
|
21
|
+
|
|
22
|
+
REPO="."
|
|
23
|
+
SNAPSHOT=""
|
|
24
|
+
OUT=""
|
|
25
|
+
|
|
26
|
+
usage() {
|
|
27
|
+
cat <<'EOF'
|
|
28
|
+
okf-emit.sh — emit an Open Knowledge Format (OKF) bundle from a graph snapshot.
|
|
29
|
+
|
|
30
|
+
Usage:
|
|
31
|
+
scripts/tools/okf-emit.sh [--repo DIR] [--snapshot DIR] [--out DIR]
|
|
32
|
+
|
|
33
|
+
Flags:
|
|
34
|
+
--repo DIR Repository root (default: cwd).
|
|
35
|
+
--snapshot DIR Snapshot dir holding architecture.json (default: <repo>/draft/graph).
|
|
36
|
+
--out DIR Bundle output dir (default: <snapshot>/okf).
|
|
37
|
+
--help Show this help.
|
|
38
|
+
|
|
39
|
+
Writes index.md + modules/<slug>.md (OKF v0.1). Exit 0 on success, 2 when no
|
|
40
|
+
architecture.json is available (nothing emitted).
|
|
41
|
+
EOF
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
while [[ $# -gt 0 ]]; do
|
|
45
|
+
case "$1" in
|
|
46
|
+
--repo) REPO="$2"; shift 2;;
|
|
47
|
+
--snapshot) SNAPSHOT="$2"; shift 2;;
|
|
48
|
+
--out) OUT="$2"; shift 2;;
|
|
49
|
+
--help|-h) usage; exit 0;;
|
|
50
|
+
-*) echo "Unknown flag: $1" >&2; usage >&2; exit 1;;
|
|
51
|
+
*) echo "Unexpected arg: $1" >&2; usage >&2; exit 1;;
|
|
52
|
+
esac
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
[[ -d "$REPO" ]] || { echo "ERROR: --repo '$REPO' is not a directory" >&2; exit 1; }
|
|
56
|
+
REPO_ABS="$(cd "$REPO" && pwd)"
|
|
57
|
+
SNAP="${SNAPSHOT:-$REPO_ABS/draft/graph}"
|
|
58
|
+
ARCH="$SNAP/architecture.json"
|
|
59
|
+
OUT="${OUT:-$SNAP/okf}"
|
|
60
|
+
|
|
61
|
+
command -v jq >/dev/null 2>&1 || { echo "jq required for OKF emit" >&2; exit 2; }
|
|
62
|
+
[[ -f "$ARCH" ]] || { echo "no architecture.json at $ARCH — nothing to emit" >&2; exit 2; }
|
|
63
|
+
|
|
64
|
+
# slugify a concept name into a filesystem- and link-safe identifier.
|
|
65
|
+
slug() {
|
|
66
|
+
local s
|
|
67
|
+
s="$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]' \
|
|
68
|
+
| sed -e 's#[^a-z0-9]\{1,\}#-#g' -e 's#^-##' -e 's#-$##')"
|
|
69
|
+
[[ -n "$s" ]] || s="module"
|
|
70
|
+
printf '%s' "$s"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# escape a value for a YAML double-quoted scalar.
|
|
74
|
+
yesc() {
|
|
75
|
+
local s="$1"
|
|
76
|
+
s="${s//\\/\\\\}"
|
|
77
|
+
s="${s//\"/\\\"}"
|
|
78
|
+
printf '%s' "$s"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
TS="$(date -Iseconds 2>/dev/null || date)"
|
|
82
|
+
PROJECT="$(jq -r '.project // "repository"' "$ARCH")"
|
|
83
|
+
TOTAL_NODES="$(jq -r '.total_nodes // 0' "$ARCH")"
|
|
84
|
+
TOTAL_EDGES="$(jq -r '.total_edges // 0' "$ARCH")"
|
|
85
|
+
|
|
86
|
+
PKGS="$(jq -r '.packages[]? | [.name, (.node_count//0), (.fan_in//0), (.fan_out//0)] | @tsv' "$ARCH")"
|
|
87
|
+
BOUNDS="$(jq -r '.boundaries[]? | [.from, .to, (.call_count//0)] | @tsv' "$ARCH")"
|
|
88
|
+
|
|
89
|
+
mkdir -p "$OUT/modules"
|
|
90
|
+
|
|
91
|
+
# --- One concept file per package, cross-linked via boundaries ---
|
|
92
|
+
PKG_COUNT=0
|
|
93
|
+
if [[ -n "$PKGS" ]]; then
|
|
94
|
+
while IFS=$'\t' read -r name nc fi fo; do
|
|
95
|
+
[[ -n "$name" ]] || continue
|
|
96
|
+
PKG_COUNT=$((PKG_COUNT + 1))
|
|
97
|
+
s="$(slug "$name")"
|
|
98
|
+
{
|
|
99
|
+
printf -- '---\n'
|
|
100
|
+
printf 'type: Module\n'
|
|
101
|
+
printf 'title: "%s"\n' "$(yesc "$name")"
|
|
102
|
+
printf 'description: "Code module %s: %s nodes, fan-in %s, fan-out %s."\n' \
|
|
103
|
+
"$(yesc "$name")" "$nc" "$fi" "$fo"
|
|
104
|
+
printf 'tags: [module, knowledge-graph]\n'
|
|
105
|
+
printf 'timestamp: "%s"\n' "$TS"
|
|
106
|
+
printf -- '---\n\n'
|
|
107
|
+
printf '# %s\n\n' "$name"
|
|
108
|
+
printf 'Structural module derived from the knowledge graph. Nodes: %s, fan-in: %s, fan-out: %s.\n' \
|
|
109
|
+
"$nc" "$fi" "$fo"
|
|
110
|
+
|
|
111
|
+
# Depends on (outbound boundaries)
|
|
112
|
+
outs="$(awk -F'\t' -v n="$name" '$1==n && $2!="" {print $2"\t"$3}' <<< "$BOUNDS")"
|
|
113
|
+
if [[ -n "$outs" ]]; then
|
|
114
|
+
printf '\n## Depends on\n\n'
|
|
115
|
+
while IFS=$'\t' read -r to cc; do
|
|
116
|
+
[[ -n "$to" ]] || continue
|
|
117
|
+
printf -- '- [%s](%s.md) — %s call(s)\n' "$to" "$(slug "$to")" "$cc"
|
|
118
|
+
done <<< "$outs"
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# Depended on by (inbound boundaries)
|
|
122
|
+
ins="$(awk -F'\t' -v n="$name" '$2==n && $1!="" {print $1"\t"$3}' <<< "$BOUNDS")"
|
|
123
|
+
if [[ -n "$ins" ]]; then
|
|
124
|
+
printf '\n## Depended on by\n\n'
|
|
125
|
+
while IFS=$'\t' read -r from cc; do
|
|
126
|
+
[[ -n "$from" ]] || continue
|
|
127
|
+
printf -- '- [%s](%s.md) — %s call(s)\n' "$from" "$(slug "$from")" "$cc"
|
|
128
|
+
done <<< "$ins"
|
|
129
|
+
fi
|
|
130
|
+
} > "$OUT/modules/$s.md"
|
|
131
|
+
done <<< "$PKGS"
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# --- Bundle index.md (reserved file: no frontmatter, §6 progressive disclosure) ---
|
|
135
|
+
{
|
|
136
|
+
printf '# %s\n\n' "$PROJECT"
|
|
137
|
+
printf 'Open Knowledge Format bundle generated by Draft from the codebase-memory-mcp knowledge graph. Nodes: %s, edges: %s, modules: %s.\n' \
|
|
138
|
+
"$TOTAL_NODES" "$TOTAL_EDGES" "$PKG_COUNT"
|
|
139
|
+
|
|
140
|
+
langs="$(jq -r '.languages[]? | "* \(.language) - \(.file_count) file(s)"' "$ARCH")"
|
|
141
|
+
if [[ -n "$langs" ]]; then
|
|
142
|
+
printf '\n# Languages\n\n%s\n' "$langs"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if [[ "$PKG_COUNT" -gt 0 ]]; then
|
|
146
|
+
printf '\n# Modules\n\n'
|
|
147
|
+
while IFS=$'\t' read -r name nc fi fo; do
|
|
148
|
+
[[ -n "$name" ]] || continue
|
|
149
|
+
printf -- '* [%s](modules/%s.md) - %s nodes, fan-in %s, fan-out %s\n' \
|
|
150
|
+
"$name" "$(slug "$name")" "$nc" "$fi" "$fo"
|
|
151
|
+
done < <(printf '%s\n' "$PKGS" | sort)
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
hot="$(jq -r '.hotspots[:10][]? | "* \(.name) - fan-in \(.fan_in)"' "$ARCH")"
|
|
155
|
+
if [[ -n "$hot" ]]; then
|
|
156
|
+
printf '\n# Top hotspots\n\n%s\n' "$hot"
|
|
157
|
+
fi
|
|
158
|
+
} > "$OUT/index.md"
|
|
159
|
+
|
|
160
|
+
echo "OKF bundle written to $OUT (modules=$PKG_COUNT)"
|
|
161
|
+
exit 0
|
package/skills/GRAPH.md
CHANGED
|
@@ -55,7 +55,6 @@ graph TD
|
|
|
55
55
|
subgraph "Architecture"
|
|
56
56
|
decompose["/draft:decompose"]
|
|
57
57
|
adr["/draft:adr"]
|
|
58
|
-
index["/draft:index"]
|
|
59
58
|
tech-debt["/draft:tech-debt"]
|
|
60
59
|
impact["/draft:impact"]
|
|
61
60
|
end
|
|
@@ -96,7 +95,6 @@ graph TD
|
|
|
96
95
|
init --> learn
|
|
97
96
|
init --> adr
|
|
98
97
|
init --> bughunt
|
|
99
|
-
init --> index
|
|
100
98
|
init --> status
|
|
101
99
|
init --> deep-review
|
|
102
100
|
init --> debug
|
|
@@ -124,7 +122,6 @@ graph TD
|
|
|
124
122
|
discover --> coverage
|
|
125
123
|
discover --> testing-strategy
|
|
126
124
|
discover --> learn
|
|
127
|
-
discover --> index
|
|
128
125
|
discover --> tour
|
|
129
126
|
discover --> impact
|
|
130
127
|
discover --> assist-review
|
|
@@ -178,8 +175,7 @@ graph TD
|
|
|
178
175
|
impact -.->|reads graph| new-track
|
|
179
176
|
impact -.->|reads graph| implement
|
|
180
177
|
|
|
181
|
-
%% Monorepo
|
|
182
|
-
init -.->|per-service| index
|
|
178
|
+
%% Monorepo: init is scope-aware — root build + module→root graph link (no separate index command)
|
|
183
179
|
```
|
|
184
180
|
|
|
185
181
|
## Dependency Matrix
|
|
@@ -193,7 +189,7 @@ graph TD
|
|
|
193
189
|
| `implement` | init, new-track | review (triggers at phase boundaries) | Modifies source code; regenerates .ai-context.md |
|
|
194
190
|
| `review` | init, new-track | implement (called at phase boundaries) | review-report-latest.md |
|
|
195
191
|
| `quick-review` | init | review (fast alternative) | quick-review-report.md |
|
|
196
|
-
| `bughunt` | init | review (optional),
|
|
192
|
+
| `bughunt` | init | review (optional), jira (optional) | bughunt-report-latest.md |
|
|
197
193
|
| `deep-review` | init | -- | deep-review audit report |
|
|
198
194
|
| `coverage` | init, new-track | -- | Regenerates .ai-context.md |
|
|
199
195
|
| `testing-strategy` | init | coverage (informs), bughunt (informs) | testing-strategy.md |
|
|
@@ -248,7 +244,8 @@ deep-review ──→ tech-debt ──→ new-track (prioritized items)
|
|
|
248
244
|
|
|
249
245
|
### Monorepo Flow
|
|
250
246
|
```
|
|
251
|
-
init (
|
|
247
|
+
init (root) → whole-repo code-graph spine + sparse root map
|
|
248
|
+
init (sub-module) → module snapshot + root-link.json → cross-module context via the root spine
|
|
252
249
|
```
|
|
253
250
|
|
|
254
251
|
### Quality Audit Flow
|
|
@@ -280,15 +277,15 @@ init → learn → (updates guardrails.md)
|
|
|
280
277
|
|
|
281
278
|
| Subroutine | Defined In | Called By |
|
|
282
279
|
|------------|-----------|----------|
|
|
283
|
-
| Condensation Subroutine (.ai-context.md regeneration) | `core/shared/condensation.md` | implement, decompose, coverage
|
|
280
|
+
| Condensation Subroutine (.ai-context.md regeneration) | `core/shared/condensation.md` | implement, decompose, coverage |
|
|
284
281
|
| Standard File Metadata (YAML frontmatter) | `init` | All skills that generate draft/ files |
|
|
285
282
|
| Three-Stage Review | `review` | implement (at phase boundaries) |
|
|
286
|
-
| Signal Classification | `init` | init refresh
|
|
283
|
+
| Signal Classification | `init` | init refresh |
|
|
287
284
|
| Pattern Learning | `core/shared/pattern-learning.md` | learn, bughunt, review, deep-review (updates guardrails.md) |
|
|
288
285
|
| Context Loading | `core/shared/draft-context-loading.md` | All skills requiring draft/ context |
|
|
289
286
|
| Cross-Skill Dispatch | `core/shared/cross-skill-dispatch.md` | bughunt, deep-review, implement, review |
|
|
290
287
|
| Jira Sync | `core/shared/jira-sync.md` | bughunt, review, implement (when ticket linked) |
|
|
291
|
-
| Graph Query | `core/shared/graph-query.md` | init, implement, bughunt, review, debug, decompose,
|
|
288
|
+
| Graph Query | `core/shared/graph-query.md` | init, implement, bughunt, review, debug, decompose, impact |
|
|
292
289
|
| Graph Mermaid | `scripts/tools/mermaid-from-graph.sh` | init (injects module-deps + proto-map into architecture.md) |
|
|
293
290
|
|
|
294
291
|
## Artifact Flow
|
package/skills/bughunt/SKILL.md
CHANGED
|
@@ -94,6 +94,19 @@ Use track context to:
|
|
|
94
94
|
|
|
95
95
|
If no Draft context exists, proceed with code-only analysis.
|
|
96
96
|
|
|
97
|
+
## Multi-Directory Mode (monorepo)
|
|
98
|
+
|
|
99
|
+
`/draft:bughunt` can sweep multiple sub-projects in one run — useful at a monorepo root. Trigger it with an explicit directory list (`bughunt <dir1> <dir2> ...`) or no list (auto-discover).
|
|
100
|
+
|
|
101
|
+
1. **Resolve targets:**
|
|
102
|
+
- **Explicit list** → use the given directories; verify each exists; skip (with a warning) any that lack a `draft/` directory.
|
|
103
|
+
- **Auto-discover** → immediate child directories containing a `draft/` folder, excluding `node_modules/`, `vendor/`, `.git/`, `draft/`, and dotfiles.
|
|
104
|
+
2. **Run sequentially** (not in parallel — avoids context conflicts): for each target, run the full single-target bug hunt below scoped to that directory. Each writes its own `<dir>/draft/bughunt-report-latest.md`.
|
|
105
|
+
3. **Aggregate** into `draft/bughunt-summary.md` at the invocation root: a table of `dir | Critical | High | Medium | Low | Total | report link`, a grand total, and a "directories with Critical issues" callout.
|
|
106
|
+
4. Report skipped directories (no `draft/`) and suggest running `/draft:init` in them first.
|
|
107
|
+
|
|
108
|
+
For a single target (the common case), skip this section and proceed.
|
|
109
|
+
|
|
97
110
|
## Dimension Applicability Check
|
|
98
111
|
|
|
99
112
|
Before analyzing all 14 dimensions, determine which apply to this codebase:
|
package/skills/discover/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: discover
|
|
3
|
-
description: "Primary router for discovery, debugging, investigation, quality, and exploration workflows. Analyzes user intent and dispatches to debug, bughunt, quick-review, deep-review, coverage, testing-strategy, learn,
|
|
3
|
+
description: "Primary router for discovery, debugging, investigation, quality, and exploration workflows. Analyzes user intent and dispatches to debug, bughunt, quick-review, deep-review, coverage, testing-strategy, learn, tour, impact, assist-review. The recommended entry point for any 'find out', 'check', 'review', or 'investigate' request."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Discover - Investigation & Quality Router
|
|
@@ -13,7 +13,6 @@ description: "Primary router for discovery, debugging, investigation, quality, a
|
|
|
13
13
|
- Code quality reviews (lightweight to exhaustive to architectural)
|
|
14
14
|
- Coverage analysis and test strategy design
|
|
15
15
|
- Discovering and codifying project conventions
|
|
16
|
-
- Monorepo indexing and context aggregation
|
|
17
16
|
- Project tours, impact analysis, or reviewer assistance
|
|
18
17
|
|
|
19
18
|
## Routing Logic
|
|
@@ -29,7 +28,6 @@ Strong keyword and phrase matching with fallback to a menu when intent is broad
|
|
|
29
28
|
| coverage, code coverage, test coverage report | `/draft:coverage` | Coverage measurement and gap report |
|
|
30
29
|
| test strategy, testing plan, coverage targets, pyramid | `/draft:testing-strategy` | Test approach design |
|
|
31
30
|
| learn patterns, discover conventions, update guardrails, anti-patterns | `/draft:learn` | Pattern mining + guardrail evolution |
|
|
32
|
-
| index services, aggregate context, monorepo index | `/draft:index` | Monorepo service context aggregation |
|
|
33
31
|
| tour, walkthrough, onboard me, getting started tour | `/draft:tour` | Guided interactive project tour |
|
|
34
32
|
| blast radius, code impact, affected modules, downstream callers | `/draft:review` or `scripts/tools/graph-impact.sh` | Graph-derived blast-radius before merge |
|
|
35
33
|
| impact, delivery telemetry, track analytics, CDD effectiveness | `/draft:impact` | Project-wide track delivery telemetry |
|
|
@@ -55,7 +53,7 @@ User: "learn the coding patterns in this repo and tighten guardrails"
|
|
|
55
53
|
|
|
56
54
|
User: "index the monorepo so agents see all services"
|
|
57
55
|
|
|
58
|
-
→
|
|
56
|
+
→ Monorepo context is a foundation task, not a discover route: run `/draft:init` at the repo root (it builds the whole-repo code graph + a sparse root map linking each module). Running `/draft:init` inside a sub-module links that module up to the same root graph.
|
|
59
57
|
|
|
60
58
|
## Auto-Chains & Recommendations
|
|
61
59
|
|
package/skills/draft/SKILL.md
CHANGED
|
@@ -39,7 +39,7 @@ The 5 router commands provide intent-based dispatch into the 20+ specialist comm
|
|
|
39
39
|
| `/draft:plan` | Planning & architecture | new-track, decompose, adr, tech-debt, change |
|
|
40
40
|
| `/draft:ops` | Operations & lifecycle | deploy-checklist, incident-response, standup, status, revert |
|
|
41
41
|
| `/draft:docs` | Authoring | documentation |
|
|
42
|
-
| `/draft:discover` | Investigation & quality | debug, bughunt, quick/deep-review, coverage, testing-strategy, learn,
|
|
42
|
+
| `/draft:discover` | Investigation & quality | debug, bughunt, quick/deep-review, coverage, testing-strategy, learn, tour, impact, assist-review |
|
|
43
43
|
| `/draft:jira` | Jira integration (preview, create, review) | - |
|
|
44
44
|
|
|
45
45
|
### Specialist Commands (leaf skills, invoked via routers or directly)
|
|
@@ -74,7 +74,7 @@ These commands remain available for targeted, specialist execution outside paren
|
|
|
74
74
|
|
|
75
75
|
#### 4. Setup & Documentation
|
|
76
76
|
* `/draft` - Display this command overview and help reference
|
|
77
|
-
* `/draft:
|
|
77
|
+
* `/draft:init` - Single scope-aware entry point: builds the root-first code graph (`draft/graph/`) and project context; run at the repo root or inside any sub-module (monorepo context comes from running it at root)
|
|
78
78
|
* `/draft:discover` - Phase 0 code-spike report (hotspots, mode flags, open questions) before spec freeze
|
|
79
79
|
* `/draft:documentation` - Generate structured codebase documentation (API, Onboarding, Runbooks)
|
|
80
80
|
* `/draft:tech-debt` - Audit technical debt across 6 key dimensions
|
|
@@ -33,5 +33,6 @@ Draft commands can be invoked using natural language. If you describe your goal
|
|
|
33
33
|
| "write docs", "create readme", "api documentation" | `/draft:documentation` | Generate professional, structured docs |
|
|
34
34
|
| "preview jira", "export jira issues", "jira draft" | `/draft:jira-preview` | Generate Jira markdown export from plan |
|
|
35
35
|
| "create jira", "push to jira board" | `/draft:jira-create` | Create actual Jira issues via MCP integrations |
|
|
36
|
-
| "index services", "aggregate context", "monorepo setup" | `/draft:
|
|
37
|
-
| "build
|
|
36
|
+
| "index services", "aggregate context", "monorepo setup" | `/draft:init` | Single entry point — run at the repo root to build the whole-repo code graph + sparse root map; run in a sub-module to link up to it |
|
|
37
|
+
| "build the code graph", "index this repo's structure", "graph memory only" | `/draft:init --graph-only` | Scope-aware, root-first code-graph build with no markdown |
|
|
38
|
+
| "build graph", "refresh graph", "rebuild the knowledge graph" | `/draft:graph` | Narrow refresh of the `draft/graph/` snapshot for one repo (optionally `draft graph <path>`) |
|
package/skills/graph/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Initialize or refresh the knowledge-graph snapshot for a repository
|
|
|
5
5
|
|
|
6
6
|
# Draft Graph
|
|
7
7
|
|
|
8
|
-
Initialize or refresh the `draft/graph/` knowledge-graph snapshot for a repository. This is the narrow "give me a fresh structural graph" command — it does **not** generate `architecture.md`/`.ai-context.md`
|
|
8
|
+
Initialize or refresh the `draft/graph/` knowledge-graph snapshot for a single repository. This is the narrow "give me a fresh structural graph" command — it does **not** generate `architecture.md`/`.ai-context.md` and does **not** re-inject doc diagram slots (both are `/draft:init`). For scope-aware, root-first graph memory across a monorepo (root spine + module→root links), use `/draft:init --graph-only`.
|
|
9
9
|
|
|
10
10
|
## Red Flags - STOP if you're:
|
|
11
11
|
|
|
@@ -55,7 +55,7 @@ echo "Engine: $ENGINE"
|
|
|
55
55
|
|
|
56
56
|
## Step 3: Build / refresh the snapshot
|
|
57
57
|
|
|
58
|
-
One call resolves the engine, indexes the repo (incrementally on refresh), and writes the committed snapshot under `<repo>/draft/graph/` — `schema.yaml`, `architecture.json`, `hotspots.jsonl`, `module-deps.mermaid`, `proto-map.mermaid
|
|
58
|
+
One call resolves the engine, indexes the repo (incrementally on refresh), and writes the committed snapshot under `<repo>/draft/graph/` — `schema.yaml`, `architecture.json`, `hotspots.jsonl`, `module-deps.mermaid`, `proto-map.mermaid`, and an Open Knowledge Format bundle under `okf/` (a portable, vendor-neutral markdown mirror of the graph — `index.md` + one cross-linked `modules/<name>.md` concept per module).
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
scripts/tools/graph-snapshot.sh --repo "$REPO_ABS"
|
|
@@ -92,7 +92,7 @@ Present a concise summary:
|
|
|
92
92
|
|
|
93
93
|
Then point the user at the natural next steps:
|
|
94
94
|
|
|
95
|
-
- To re-inject the refreshed diagrams/hotspot tables into `architecture.md` / `.ai-context.md`: run `/draft:
|
|
95
|
+
- To re-inject the refreshed diagrams/hotspot tables into `architecture.md` / `.ai-context.md`: run `/draft:init refresh` (or `/draft:init --graph-only` to rebuild just the graph memory).
|
|
96
96
|
- For a first-time full context bootstrap (architecture + profiles): run `/draft:init`.
|
|
97
97
|
|
|
98
98
|
## Graceful Degradation
|