@tduyng/pi-devos 0.0.0-stage → 0.14.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 (109) hide show
  1. package/CHANGELOG.md +1421 -0
  2. package/LICENSE +201 -0
  3. package/README.md +206 -2
  4. package/package.json +44 -4
  5. package/plugins/devos/agents/reader.md +27 -0
  6. package/plugins/devos/agents/verifier.md +155 -0
  7. package/plugins/devos/pi/extension/devos.ts +605 -0
  8. package/plugins/devos/scripts/check-evidence-router.sh +140 -0
  9. package/plugins/devos/scripts/evidence-router.py +254 -0
  10. package/plugins/devos/scripts/gates/check-dod-core.sh +285 -0
  11. package/plugins/devos/scripts/gates/check-dod.sh +38 -0
  12. package/plugins/devos/scripts/gates/check-implementation-boundary.sh +99 -0
  13. package/plugins/devos/scripts/gates/check-port-source.sh +134 -0
  14. package/plugins/devos/scripts/gates/check-report-locations.sh +148 -0
  15. package/plugins/devos/scripts/gates/check-scenario-coverage.sh +104 -0
  16. package/plugins/devos/scripts/gates/gate-check.mjs +204 -0
  17. package/plugins/devos/scripts/gates/phase-gate.sh +208 -0
  18. package/plugins/devos/scripts/gates/plan-template-check.py +141 -0
  19. package/plugins/devos/scripts/gates/run-gate.sh +148 -0
  20. package/plugins/devos/scripts/gates/spec-contract.sh +19 -0
  21. package/plugins/devos/scripts/gates/spec-template-check.py +152 -0
  22. package/plugins/devos/scripts/gates/suite/01-dod.sh +485 -0
  23. package/plugins/devos/scripts/gates/suite/02-integrity.sh +310 -0
  24. package/plugins/devos/scripts/gates/suite/03-archetype.sh +255 -0
  25. package/plugins/devos/scripts/gates/suite/04-spec-validator.sh +183 -0
  26. package/plugins/devos/scripts/gates/suite/05-requires.sh +360 -0
  27. package/plugins/devos/scripts/gates/suite/06-clarify-adapters.sh +435 -0
  28. package/plugins/devos/scripts/gates/suite/07-lint-evals.sh +350 -0
  29. package/plugins/devos/scripts/gates/suite/08-converge.sh +591 -0
  30. package/plugins/devos/scripts/gates/suite/09-quality.sh +516 -0
  31. package/plugins/devos/scripts/gates/suite/10-eval-harness.sh +679 -0
  32. package/plugins/devos/scripts/gates/test-gates.sh +76 -0
  33. package/plugins/devos/scripts/gates/test-integrity-rubric.sh +152 -0
  34. package/plugins/devos/scripts/gates/test-phase-gate.sh +116 -0
  35. package/plugins/devos/skills/absorb/SKILL.md +75 -0
  36. package/plugins/devos/skills/absorb/references/distill.md +67 -0
  37. package/plugins/devos/skills/absorb/scripts/check-refs.sh +108 -0
  38. package/plugins/devos/skills/absorb/scripts/knowledge.py +258 -0
  39. package/plugins/devos/skills/build/SKILL.md +71 -0
  40. package/plugins/devos/skills/build/references/advanced-routing.md +19 -0
  41. package/plugins/devos/skills/build/references/defect.md +17 -0
  42. package/plugins/devos/skills/build/references/exposure.md +28 -0
  43. package/plugins/devos/skills/build/references/hard.md +39 -0
  44. package/plugins/devos/skills/build/references/refactor.md +66 -0
  45. package/plugins/devos/skills/build/references/routes.md +56 -0
  46. package/plugins/devos/skills/build/references/scale.md +84 -0
  47. package/plugins/devos/skills/build/references/spike.md +19 -0
  48. package/plugins/devos/skills/build/scripts/construct-census.py +204 -0
  49. package/plugins/devos/skills/build/scripts/dep-order.py +297 -0
  50. package/plugins/devos/skills/build/scripts/ledger.sh +228 -0
  51. package/plugins/devos/skills/build/scripts/route.sh +5 -0
  52. package/plugins/devos/skills/build/scripts/secret-scan.sh +121 -0
  53. package/plugins/devos/skills/build/scripts/toolchain-preflight.py +302 -0
  54. package/plugins/devos/skills/frame/SKILL.md +54 -0
  55. package/plugins/devos/skills/frame/references/template.md +115 -0
  56. package/plugins/devos/skills/frame/scripts/survey.sh +44 -0
  57. package/plugins/devos/skills/implement/SKILL.md +36 -0
  58. package/plugins/devos/skills/implement/references/conditional-plan.md +17 -0
  59. package/plugins/devos/skills/implement/references/debug-loop.md +7 -0
  60. package/plugins/devos/skills/implement/references/dod.md +37 -0
  61. package/plugins/devos/skills/implement/references/implement.md +54 -0
  62. package/plugins/devos/skills/implement/references/manual-gates.md +16 -0
  63. package/plugins/devos/skills/implement/references/plan.md +142 -0
  64. package/plugins/devos/skills/implement/references/resume.md +9 -0
  65. package/plugins/devos/skills/implement/references/scale.md +86 -0
  66. package/plugins/devos/skills/implement/references/verify-close.md +62 -0
  67. package/plugins/devos/skills/implement/references/visual-verification.md +7 -0
  68. package/plugins/devos/skills/implement/scripts/check-converge.sh +147 -0
  69. package/plugins/devos/skills/implement/scripts/equivalence-check.sh +140 -0
  70. package/plugins/devos/skills/implement/scripts/manifest-queue.sh +185 -0
  71. package/plugins/devos/skills/implement/scripts/ops-log.sh +58 -0
  72. package/plugins/devos/skills/implement/scripts/pilot-consistency.py +173 -0
  73. package/plugins/devos/skills/implement/scripts/validate-spec.sh +220 -0
  74. package/plugins/devos/skills/init/SKILL.md +100 -0
  75. package/plugins/devos/skills/init/references/archetype-sections.md +15 -0
  76. package/plugins/devos/skills/init/references/context.md +42 -0
  77. package/plugins/devos/skills/init/references/conventions-template.md +153 -0
  78. package/plugins/devos/skills/init/references/reverse-engineer.md +3 -0
  79. package/plugins/devos/skills/init/references/rule-format.md +58 -0
  80. package/plugins/devos/skills/init/references/shape-model.md +29 -0
  81. package/plugins/devos/skills/init/scripts/detect-archetype.py +461 -0
  82. package/plugins/devos/skills/init/scripts/render-rule.py +114 -0
  83. package/plugins/devos/skills/init/scripts/reverse-engineer.sh +162 -0
  84. package/plugins/devos/skills/learn/SKILL.md +29 -0
  85. package/plugins/devos/skills/learn/references/destinations.md +43 -0
  86. package/plugins/devos/skills/learn/references/scoring.md +26 -0
  87. package/plugins/devos/skills/review/SKILL.md +54 -0
  88. package/plugins/devos/skills/review/references/comments.md +13 -0
  89. package/plugins/devos/skills/review/references/gaps.md +26 -0
  90. package/plugins/devos/skills/review/references/reviewer.md +124 -0
  91. package/plugins/devos/skills/review/references/routing.md +35 -0
  92. package/plugins/devos/skills/review/scripts/__pycache__/prepare.cpython-313.pyc +0 -0
  93. package/plugins/devos/skills/review/scripts/prepare.py +763 -0
  94. package/plugins/devos/skills/spec/SKILL.md +57 -0
  95. package/plugins/devos/skills/spec/references/prototype.md +21 -0
  96. package/plugins/devos/skills/spec/references/question-craft.md +47 -0
  97. package/plugins/devos/skills/spec/references/roadmap-link.md +5 -0
  98. package/plugins/devos/skills/spec/references/write-spec.md +128 -0
  99. package/plugins/devos/skills/spec/scripts/clarify.sh +173 -0
  100. package/plugins/devos/skills/status/SKILL.md +67 -0
  101. package/plugins/devos/skills/status/references/cost.md +38 -0
  102. package/plugins/devos/skills/status/scripts/artifact-budgets.sh +88 -0
  103. package/plugins/devos/skills/status/scripts/check-requires.py +556 -0
  104. package/plugins/devos/skills/status/scripts/context-cost.sh +89 -0
  105. package/plugins/devos/skills/status/scripts/convention-usage.sh +184 -0
  106. package/plugins/devos/skills/status/scripts/findings-summary.sh +112 -0
  107. package/plugins/devos/skills/status/scripts/quality-correlation.sh +259 -0
  108. package/plugins/devos/skills/status/scripts/sizing-calibration.sh +71 -0
  109. package/plugins/devos/skills/status/scripts/spec-diff.sh +137 -0
@@ -0,0 +1,137 @@
1
+ #!/bin/bash
2
+ # /devos:status --compare: structural comparison of two specs' spec.md files.
3
+ # Deterministic, zero model calls.
4
+ #
5
+ # Usage: spec-diff.sh <spec-a> <spec-b> [project-root]
6
+ # Spec names are directory names under devos/specs/ or devos/specs/archive/.
7
+ # project-root defaults to pwd (the user's project directory).
8
+ #
9
+ # Compares, against the spec.md template in implement/SKILL.md: Implementation
10
+ # Plan task groups, each task group's inline Acceptance Criteria line, Code
11
+ # Map file list, and the Change Log (the amendment record after approval).
12
+ # spec.md has no separate "Behavior delta" heading of its own (that term
13
+ # names the merge step into devos/product/behaviors/, not a section in
14
+ # spec.md), so this tool doesn't claim to diff one. Structural comparison
15
+ # only, no semantic analysis, same shape as a `diff` command for markdown
16
+ # files with a known layout.
17
+ set -u
18
+
19
+ if [[ $# -lt 2 ]]; then
20
+ echo "Usage: $0 <spec-a> <spec-b> [project-root]" >&2
21
+ exit 2
22
+ fi
23
+
24
+ a_name="$1"
25
+ b_name="$2"
26
+ PROJECT_ROOT="${3:-$(pwd)}"
27
+
28
+ valid_name() {
29
+ [[ -n "$1" && "$1" != "." && "$1" != ".." && "$1" != */* ]]
30
+ }
31
+
32
+ if ! valid_name "$a_name" || ! valid_name "$b_name"; then
33
+ echo "ERROR spec names must be single directory names without path separators" >&2
34
+ exit 2
35
+ fi
36
+
37
+ resolve() { # $1 = spec name -> path to its spec.md, or empty + stderr message
38
+ local name="$1" active_dir archive_dir
39
+ active_dir="$PROJECT_ROOT/devos/specs/$name"
40
+ archive_dir="$PROJECT_ROOT/devos/specs/archive/$name"
41
+ if [[ -d "$active_dir" ]]; then
42
+ if [[ -f "$active_dir/spec.md" ]]; then
43
+ echo "$active_dir/spec.md"
44
+ return 0
45
+ fi
46
+ echo "ERROR active spec '$name' exists but its spec.md is missing; refusing to compare an archived fallback" >&2
47
+ return 1
48
+ fi
49
+ if [[ -f "$archive_dir/spec.md" ]]; then
50
+ echo "$archive_dir/spec.md"
51
+ return 0
52
+ fi
53
+ echo "ERROR no spec.md found for '$name' under devos/specs/ or devos/specs/archive/" >&2
54
+ return 1
55
+ }
56
+
57
+ a=$(resolve "$a_name") || exit 1
58
+ b=$(resolve "$b_name") || exit 1
59
+
60
+ echo "Structural diff: $a_name vs $b_name"
61
+ echo "=============================="
62
+ echo ""
63
+
64
+ # Lines strictly between a start pattern and the next level-2 header,
65
+ # excluding both boundary lines. Portable (no GNU-only head -n -1, which
66
+ # silently returns empty under BSD/macOS head).
67
+ section() { # $1=file $2=start-regex
68
+ awk -v start="$2" '
69
+ $0 ~ start { f = 1; next }
70
+ f && /^## / { f = 0 }
71
+ f { print }
72
+ ' "$1"
73
+ }
74
+
75
+ report_diff() { # $1=label $2=a-content $3=b-content
76
+ if [[ "$2" == "$3" ]]; then
77
+ echo "$1 are identical."
78
+ else
79
+ echo "$1 differ:"
80
+ diff <(printf '%s\n' "$2") <(printf '%s\n' "$3") | sed 's/^/ /' || true
81
+ fi
82
+ }
83
+
84
+ echo "## Implementation Plan task groups"
85
+ # Same shape every other plan reader in the plugin uses ('###' + any run of
86
+ # spaces + 'Task' + any run of spaces + 'Group', then whitespace or a colon).
87
+ # The literal '### Task Group' made a plan whose headers carry an extra space
88
+ # look like it had no groups at all, and two plans that disagree on group 2 were
89
+ # reported as identical. Requiring whitespace after 'Group' then hid the
90
+ # colon form that check-converge.sh reads, and two plans whose only group is
91
+ # written that way compared as identical because both sides were empty.
92
+ group_re='^###[[:space:]]+Task[[:space:]]+Group([[:space:]]+|:)'
93
+ a_tasks=$(grep -E "$group_re" "$a" 2>/dev/null || true)
94
+ b_tasks=$(grep -E "$group_re" "$b" 2>/dev/null || true)
95
+ report_diff "Task groups" "$a_tasks" "$b_tasks"
96
+ echo ""
97
+
98
+ echo "## Acceptance Criteria (per task group)"
99
+ a_ac=$(grep -E '^\*\*Acceptance Criteria:\*\*' "$a" 2>/dev/null || true)
100
+ b_ac=$(grep -E '^\*\*Acceptance Criteria:\*\*' "$b" 2>/dev/null || true)
101
+ report_diff "Acceptance criteria" "$a_ac" "$b_ac"
102
+ echo ""
103
+
104
+ echo "## Code Map overlap"
105
+ a_map=$(section "$a" '^## Code Map')
106
+ b_map=$(section "$b" '^## Code Map')
107
+ a_files=$(printf '%s\n' "$a_map" | grep -oE '`[^`]+`' | tr -d '`' | sort -u)
108
+ b_files=$(printf '%s\n' "$b_map" | grep -oE '`[^`]+`' | tr -d '`' | sort -u)
109
+
110
+ if [[ -z "$a_files" && -z "$b_files" ]]; then
111
+ echo "Neither spec has a Code Map."
112
+ else
113
+ shared=$(comm -12 <(printf '%s\n' "$a_files") <(printf '%s\n' "$b_files") | grep -c . || true)
114
+ a_only=$(comm -23 <(printf '%s\n' "$a_files") <(printf '%s\n' "$b_files") | grep -c . || true)
115
+ b_only=$(comm -13 <(printf '%s\n' "$a_files") <(printf '%s\n' "$b_files") | grep -c . || true)
116
+ echo "Shared files: $shared, Only in $a_name: $a_only, Only in $b_name: $b_only"
117
+ if ((shared > 0)); then
118
+ echo "Shared:"
119
+ comm -12 <(printf '%s\n' "$a_files") <(printf '%s\n' "$b_files") | sed 's/^/ /'
120
+ fi
121
+ if ((a_only > 0)); then
122
+ echo "Only in $a_name:"
123
+ comm -23 <(printf '%s\n' "$a_files") <(printf '%s\n' "$b_files") | sed 's/^/ /'
124
+ fi
125
+ if ((b_only > 0)); then
126
+ echo "Only in $b_name:"
127
+ comm -13 <(printf '%s\n' "$a_files") <(printf '%s\n' "$b_files") | sed 's/^/ /'
128
+ fi
129
+ fi
130
+ echo ""
131
+
132
+ echo "## Change Log"
133
+ a_log=$(section "$a" '^## Change Log')
134
+ b_log=$(section "$b" '^## Change Log')
135
+ report_diff "Change logs" "$a_log" "$b_log"
136
+
137
+ exit 0