ai-core-framework 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 (103) hide show
  1. package/.claude-plugin/plugin.json +21 -0
  2. package/.codex-plugin/plugin.json +35 -0
  3. package/.cursor-plugin/plugin.json +22 -0
  4. package/README.md +173 -0
  5. package/bin/ai-core-framework.js +110 -0
  6. package/core/README.md +162 -0
  7. package/core/agents/README.md +32 -0
  8. package/core/agents/business-analyst.md +269 -0
  9. package/core/agents/developer.md +375 -0
  10. package/core/agents/qa-tester.md +477 -0
  11. package/core/agents/scrum-master.md +136 -0
  12. package/core/agents/tech-lead.md +345 -0
  13. package/core/config/backlog.schema.json +38 -0
  14. package/core/config/docs-policy.default.json +37 -0
  15. package/core/config/release.schema.json +120 -0
  16. package/core/config/ticket.schema.json +253 -0
  17. package/core/rules/00-global-rules.md +373 -0
  18. package/core/rules/01-git-workflow.md +388 -0
  19. package/core/rules/02-code-quality.md +77 -0
  20. package/core/rules/03-security.md +78 -0
  21. package/core/rules/04-documentation.md +72 -0
  22. package/core/rules/05-testing-mandatory.md +374 -0
  23. package/core/rules/06-approval-gates.md +388 -0
  24. package/core/rules/07-definition-of-ready.md +112 -0
  25. package/core/rules/08-definition-of-done.md +149 -0
  26. package/core/scripts/ai-core.sh +456 -0
  27. package/core/scripts/generate-views.sh +210 -0
  28. package/core/scripts/install-codex-prompts.sh +127 -0
  29. package/core/scripts/log-user-request.sh +113 -0
  30. package/core/scripts/setup-project.sh +183 -0
  31. package/core/scripts/sync-platforms.sh +322 -0
  32. package/core/scripts/validate-audit-log.sh +73 -0
  33. package/core/scripts/validate-docs.sh +365 -0
  34. package/core/scripts/validate-permissions.sh +132 -0
  35. package/core/scripts/validate-state.sh +611 -0
  36. package/core/scripts/workflow.sh +513 -0
  37. package/core/skills/README.md +21 -0
  38. package/core/skills/ai-core-commands/SKILL.md +86 -0
  39. package/core/skills/brainstorming/SKILL.md +40 -0
  40. package/core/skills/development-implement-task/SKILL.md +308 -0
  41. package/core/skills/executing-ticket/SKILL.md +28 -0
  42. package/core/skills/git-branch-status/SKILL.md +56 -0
  43. package/core/skills/git-cleanup-branches/SKILL.md +57 -0
  44. package/core/skills/git-scan-untracked/SKILL.md +50 -0
  45. package/core/skills/meta-generate-views/SKILL.md +54 -0
  46. package/core/skills/meta-request-log/SKILL.md +61 -0
  47. package/core/skills/meta-sprint-report/SKILL.md +59 -0
  48. package/core/skills/meta-sync-platforms/SKILL.md +53 -0
  49. package/core/skills/meta-ticket-health/SKILL.md +61 -0
  50. package/core/skills/meta-validate-audit-log/SKILL.md +42 -0
  51. package/core/skills/meta-validate-docs/SKILL.md +58 -0
  52. package/core/skills/meta-validate-permissions/SKILL.md +53 -0
  53. package/core/skills/meta-validate-state/SKILL.md +58 -0
  54. package/core/skills/planning-analyze-requirements/SKILL.md +471 -0
  55. package/core/skills/planning-backlog-status/SKILL.md +57 -0
  56. package/core/skills/planning-document-existing-requirements/SKILL.md +246 -0
  57. package/core/skills/planning-estimate-task/SKILL.md +60 -0
  58. package/core/skills/planning-groom-ticket/SKILL.md +442 -0
  59. package/core/skills/planning-mark-ready/SKILL.md +111 -0
  60. package/core/skills/planning-plan-refactor/SKILL.md +66 -0
  61. package/core/skills/planning-plan-sprint/SKILL.md +112 -0
  62. package/core/skills/planning-prioritize-backlog/SKILL.md +62 -0
  63. package/core/skills/planning-write-plan/SKILL.md +68 -0
  64. package/core/skills/project-detect-stack/SKILL.md +71 -0
  65. package/core/skills/project-discover-codebase/SKILL.md +74 -0
  66. package/core/skills/project-setup-project/SKILL.md +113 -0
  67. package/core/skills/qa-bug-status/SKILL.md +52 -0
  68. package/core/skills/qa-report-bug/SKILL.md +518 -0
  69. package/core/skills/qa-smoke-test/SKILL.md +387 -0
  70. package/core/skills/qa-triage-bug/SKILL.md +62 -0
  71. package/core/skills/qa-verify-fix/SKILL.md +446 -0
  72. package/core/skills/release-hotfix/SKILL.md +117 -0
  73. package/core/skills/release-release/SKILL.md +123 -0
  74. package/core/skills/release-rollback/SKILL.md +62 -0
  75. package/core/skills/review-create-pr/SKILL.md +418 -0
  76. package/core/skills/review-merge-pr/SKILL.md +425 -0
  77. package/core/skills/review-techlead-review/SKILL.md +547 -0
  78. package/core/skills/using-ai-core/SKILL.md +72 -0
  79. package/core/skills/verification-before-done/SKILL.md +35 -0
  80. package/core/skills/writing-implementation-plan/SKILL.md +45 -0
  81. package/core/templates/ci/ai-core-governance.yml +112 -0
  82. package/core/templates/ci/node-pnpm.yml +35 -0
  83. package/core/templates/pm/retrospective-template.md +47 -0
  84. package/core/templates/pm/sprint-plan-template.md +45 -0
  85. package/core/templates/pr/pull-request-template.md +247 -0
  86. package/core/templates/project/CODEOWNERS +11 -0
  87. package/core/templates/project/docs-policy.json +3 -0
  88. package/core/templates/project/project-config.yaml +137 -0
  89. package/core/templates/project/project-structure.yaml +76 -0
  90. package/core/templates/qa/bug-report-template.md +371 -0
  91. package/core/templates/qa/test-plan-template.md +57 -0
  92. package/core/templates/release/release-record-template.json +67 -0
  93. package/core/templates/requirements/PRD-template.md +58 -0
  94. package/core/templates/requirements/user-story-template.md +381 -0
  95. package/core/templates/technical/ADR-template.md +46 -0
  96. package/core/templates/technical/refactor-plan-template.md +84 -0
  97. package/core/templates/technical/tech-design-template.md +71 -0
  98. package/core/workflows/bug-lifecycle.md +56 -0
  99. package/core/workflows/feature-lifecycle.md +347 -0
  100. package/core/workflows/hotfix-lifecycle.md +65 -0
  101. package/core/workflows/sprint-lifecycle.md +56 -0
  102. package/lib/install-codex.js +85 -0
  103. package/package.json +36 -0
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env bash
2
+ # core/scripts/install-codex-prompts.sh
3
+ #
4
+ # Installs AI Core command wrappers as Codex custom slash prompts.
5
+ #
6
+ # Usage:
7
+ # bash core/scripts/install-codex-prompts.sh
8
+ # CODEX_PROMPTS_DIR=~/.codex/prompts bash core/scripts/install-codex-prompts.sh
9
+
10
+ set -euo pipefail
11
+
12
+ PROMPTS_DIR="${CODEX_PROMPTS_DIR:-$HOME/.codex/prompts}"
13
+
14
+ RED='\033[0;31m'
15
+ GREEN='\033[0;32m'
16
+ BLUE='\033[0;34m'
17
+ NC='\033[0m'
18
+
19
+ log_info() { echo -e "${BLUE}i${NC} $1"; }
20
+ log_pass() { echo -e "${GREEN}+${NC} $1"; }
21
+ log_fail() { echo -e "${RED}x${NC} $1"; }
22
+
23
+ repo_root() {
24
+ git rev-parse --show-toplevel 2>/dev/null || pwd
25
+ }
26
+
27
+ extract_frontmatter_value() {
28
+ local key="$1"
29
+ local file="$2"
30
+ awk -F': *' -v key="$key" '
31
+ $0 == "---" { markers += 1; next }
32
+ markers == 1 && $1 == key { print $2; exit }
33
+ markers >= 2 { exit }
34
+ ' "$file" | sed -E 's/^"//; s/"$//'
35
+ }
36
+
37
+ write_prompt() {
38
+ local command_file="$1"
39
+ local root="$2"
40
+ local command display_name description prompt_file rel_command_file fallback_command_file fallback_rules_file fallback_agents_dir fallback_log_script
41
+
42
+ command="$(extract_frontmatter_value command "$command_file")"
43
+ display_name="$(extract_frontmatter_value display_name "$command_file")"
44
+
45
+ if [ -z "$command" ]; then
46
+ log_info "Skipping non-command file: $command_file"
47
+ return 0
48
+ fi
49
+
50
+ prompt_file="$PROMPTS_DIR/${command#/}.md"
51
+ rel_command_file="${command_file#./}"
52
+ fallback_command_file="${root}/${rel_command_file}"
53
+ fallback_rules_file="${root}/core/rules/00-global-rules.md"
54
+ fallback_agents_dir="${root}/core/agents"
55
+ fallback_log_script="${root}/core/scripts/log-user-request.sh"
56
+ description="${display_name:-AI Core command ${command}}"
57
+
58
+ cat > "$prompt_file" <<EOF
59
+ # ${command}
60
+
61
+ ${description}
62
+
63
+ You are executing the AI Core custom slash command \`${command}\`.
64
+
65
+ User arguments:
66
+
67
+ \`\`\`text
68
+ \$ARGUMENTS
69
+ \`\`\`
70
+
71
+ Mandatory steps:
72
+
73
+ 1. Log this user request first. Prefer the project-local script when it exists; otherwise use the installed AI Core fallback:
74
+ \`\`\`bash
75
+ if [ -f core/scripts/log-user-request.sh ]; then
76
+ AI_AGENT=codex bash core/scripts/log-user-request.sh "${command} \$ARGUMENTS"
77
+ else
78
+ AI_AGENT=codex bash ${fallback_log_script} "${command} \$ARGUMENTS"
79
+ fi
80
+ \`\`\`
81
+
82
+ 2. Read and follow this command spec exactly. Prefer the project-local path when it exists; otherwise use the installed AI Core fallback:
83
+ \`\`\`text
84
+ ${rel_command_file}
85
+ ${fallback_command_file}
86
+ \`\`\`
87
+
88
+ 3. Read and follow the global rules. Prefer the project-local path when it exists; otherwise use the installed AI Core fallback:
89
+ \`\`\`text
90
+ core/rules/00-global-rules.md
91
+ ${fallback_rules_file}
92
+ \`\`\`
93
+
94
+ 4. Infer the owner agent from the command frontmatter. If an agent file exists, read it before acting. Prefer the project-local path, then the installed fallback:
95
+ \`\`\`text
96
+ core/agents/<owner_agent>.md
97
+ ${fallback_agents_dir}/<owner_agent>.md
98
+ \`\`\`
99
+
100
+ 5. Execute in chat-first mode. Do not ask the user to run shell wrappers unless the command explicitly requires deterministic script execution.
101
+
102
+ 6. Report the command executed, inferred agent, files changed, validation result, and suggested next AI Core command.
103
+ EOF
104
+
105
+ log_pass "Installed ${prompt_file}"
106
+ }
107
+
108
+ main() {
109
+ local root
110
+ root="$(repo_root)"
111
+ cd "$root"
112
+
113
+ if [ ! -d "core/commands" ]; then
114
+ log_fail "Missing core/commands. Run from AI Core repo root."
115
+ exit 1
116
+ fi
117
+
118
+ mkdir -p "$PROMPTS_DIR"
119
+
120
+ while IFS= read -r command_file; do
121
+ write_prompt "$command_file" "$root"
122
+ done < <(find core/commands -name '*.md' -type f | sort)
123
+
124
+ log_pass "AI Core Codex prompts installed in ${PROMPTS_DIR}"
125
+ }
126
+
127
+ main "$@"
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env bash
2
+ # core/scripts/log-user-request.sh
3
+ #
4
+ # Append a sanitized user request record to project/user-requests.jsonl.
5
+ #
6
+ # Usage:
7
+ # bash core/scripts/log-user-request.sh "user request text"
8
+
9
+ set -euo pipefail
10
+
11
+ REQUEST_TEXT="${*:-}"
12
+ LOG_FILE="${AI_CORE_USER_REQUEST_LOG:-project/user-requests.jsonl}"
13
+
14
+ RED='\033[0;31m'
15
+ GREEN='\033[0;32m'
16
+ NC='\033[0m'
17
+
18
+ log_pass() { echo -e "${GREEN}+${NC} $1"; }
19
+ log_fail() { echo -e "${RED}x${NC} $1"; }
20
+
21
+ if [ -z "$REQUEST_TEXT" ]; then
22
+ log_fail "Usage: bash core/scripts/log-user-request.sh \"user request text\""
23
+ exit 2
24
+ fi
25
+
26
+ if ! command -v jq >/dev/null 2>&1; then
27
+ log_fail "jq not installed. Install with: brew install jq"
28
+ exit 2
29
+ fi
30
+
31
+ now_utc() {
32
+ date -u +%Y-%m-%dT%H:%M:%SZ
33
+ }
34
+
35
+ agent_name() {
36
+ local agent="${AI_AGENT:-unknown-agent}"
37
+ if [[ "$agent" == *-agent ]]; then
38
+ printf '%s' "$agent"
39
+ else
40
+ printf '%s-agent' "$agent"
41
+ fi
42
+ }
43
+
44
+ hash_value() {
45
+ local value="$1"
46
+ if command -v sha256sum >/dev/null 2>&1; then
47
+ printf '%s' "$value" | sha256sum | awk '{print $1}'
48
+ else
49
+ printf '%s' "$value" | shasum -a 256 | awk '{print $1}'
50
+ fi
51
+ }
52
+
53
+ sanitize_request() {
54
+ printf '%s' "$1" |
55
+ sed -E \
56
+ -e 's/([Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd][[:space:]]*[:=][[:space:]]*)[^[:space:]]+/\1[REDACTED]/g' \
57
+ -e 's/([Tt][Oo][Kk][Ee][Nn][[:space:]]*[:=][[:space:]]*)[^[:space:]]+/\1[REDACTED]/g' \
58
+ -e 's/([Aa][Pp][Ii][_-]?[Kk][Ee][Yy][[:space:]]*[:=][[:space:]]*)[^[:space:]]+/\1[REDACTED]/g' \
59
+ -e 's/(Bearer[[:space:]]+)[A-Za-z0-9._~+\/=-]+/\1[REDACTED]/g' \
60
+ -e 's/(AKIA[A-Z0-9]{16})/[REDACTED_AWS_KEY]/g'
61
+ }
62
+
63
+ detect_command() {
64
+ printf '%s' "$1" | awk '{print $1}' | grep -E '^/' || true
65
+ }
66
+
67
+ detect_ticket() {
68
+ printf '%s' "$1" | grep -Eo 'TICKET-[0-9]+' | head -1 || true
69
+ }
70
+
71
+ last_hash() {
72
+ if [ ! -s "$LOG_FILE" ]; then
73
+ printf ''
74
+ return 0
75
+ fi
76
+ tail -1 "$LOG_FILE" | jq -r '.hash // empty'
77
+ }
78
+
79
+ mkdir -p "$(dirname "$LOG_FILE")"
80
+ touch "$LOG_FILE"
81
+
82
+ AT="$(now_utc)"
83
+ BY="$(agent_name)"
84
+ SANITIZED="$(sanitize_request "$REQUEST_TEXT")"
85
+ REQUEST_HASH="$(hash_value "$REQUEST_TEXT")"
86
+ COMMAND="$(detect_command "$SANITIZED")"
87
+ TICKET_ID="$(detect_ticket "$SANITIZED")"
88
+ PREV_HASH="$(last_hash)"
89
+
90
+ PAYLOAD="$(jq -cn \
91
+ --arg at "$AT" \
92
+ --arg by "$BY" \
93
+ --arg source "chat" \
94
+ --arg request "$SANITIZED" \
95
+ --arg request_hash "$REQUEST_HASH" \
96
+ --arg command "$COMMAND" \
97
+ --arg ticket_id "$TICKET_ID" \
98
+ --arg prev_hash "$PREV_HASH" \
99
+ '{
100
+ at:$at,
101
+ by_agent:$by,
102
+ source:$source,
103
+ request:$request,
104
+ request_hash:$request_hash,
105
+ command:(if ($command | length) > 0 then $command else null end),
106
+ ticket_id:(if ($ticket_id | length) > 0 then $ticket_id else null end),
107
+ redaction:"Secrets and obvious credentials are redacted before logging.",
108
+ prev_hash:$prev_hash
109
+ }')"
110
+ HASH="$(hash_value "$PAYLOAD")"
111
+
112
+ jq -cn --argjson payload "$PAYLOAD" --arg hash "$HASH" '$payload + {hash:$hash}' >> "$LOG_FILE"
113
+ log_pass "Logged user request to $LOG_FILE"
@@ -0,0 +1,183 @@
1
+ #!/usr/bin/env bash
2
+ # core/scripts/setup-project.sh
3
+ #
4
+ # Makes a copied core/ framework operational in a project.
5
+ #
6
+ # Usage:
7
+ # bash core/scripts/setup-project.sh
8
+
9
+ set -euo pipefail
10
+
11
+ RED='\033[0;31m'
12
+ GREEN='\033[0;32m'
13
+ YELLOW='\033[1;33m'
14
+ BLUE='\033[0;34m'
15
+ NC='\033[0m'
16
+
17
+ log_info() { echo -e "${BLUE}i${NC} $1"; }
18
+ log_pass() { echo -e "${GREEN}+${NC} $1"; }
19
+ log_warn() { echo -e "${YELLOW}!${NC} $1"; }
20
+ log_fail() { echo -e "${RED}x${NC} $1"; }
21
+
22
+ copy_if_missing() {
23
+ local src="$1"
24
+ local dst="$2"
25
+
26
+ if [ -f "$dst" ]; then
27
+ log_pass "Preserved existing $dst"
28
+ return 0
29
+ fi
30
+
31
+ cp "$src" "$dst"
32
+ log_pass "Created $dst"
33
+ }
34
+
35
+ write_backlog_if_missing() {
36
+ local path="project/backlog/backlog.json"
37
+
38
+ if [ -f "$path" ]; then
39
+ log_pass "Preserved existing $path"
40
+ return 0
41
+ fi
42
+
43
+ printf '{\n "version": "1.0.0",\n "updated_at": "%s",\n "updated_by": "setup-project",\n "strategy": "ranked",\n "items": []\n}\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "$path"
44
+ log_pass "Created $path"
45
+ }
46
+
47
+ install_framework_scripts() {
48
+ mkdir -p scripts
49
+
50
+ for script in ai-core.sh workflow.sh validate-state.sh validate-docs.sh validate-permissions.sh validate-audit-log.sh generate-views.sh install-codex-prompts.sh log-user-request.sh setup-project.sh; do
51
+ local src="core/scripts/$script"
52
+ local dst="scripts/$script"
53
+
54
+ if [ ! -f "$src" ]; then
55
+ log_warn "Missing $src; cannot install $dst"
56
+ continue
57
+ fi
58
+
59
+ if [ -f "$dst" ]; then
60
+ log_pass "Preserved existing $dst"
61
+ continue
62
+ fi
63
+
64
+ cp "$src" "$dst"
65
+ chmod +x "$dst"
66
+ log_pass "Installed $dst"
67
+ done
68
+ }
69
+
70
+ install_governance_workflow() {
71
+ local src="core/templates/ci/ai-core-governance.yml"
72
+ local dst=".github/workflows/ai-core-governance.yml"
73
+
74
+ if [ ! -f "$src" ]; then
75
+ log_warn "Missing $src; governance workflow not installed"
76
+ return 0
77
+ fi
78
+
79
+ mkdir -p .github/workflows
80
+
81
+ if [ -f "$dst" ]; then
82
+ log_pass "Preserved existing $dst"
83
+ return 0
84
+ fi
85
+
86
+ cp "$src" "$dst"
87
+ log_pass "Installed $dst"
88
+ }
89
+
90
+ main() {
91
+ echo ""
92
+ echo "========================================================"
93
+ echo " Setting up AI Core project runtime"
94
+ echo "========================================================"
95
+ echo ""
96
+
97
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then
98
+ log_fail "Not in a git repository"
99
+ exit 1
100
+ fi
101
+
102
+ local repo_root
103
+ repo_root=$(git rev-parse --show-toplevel)
104
+ cd "$repo_root"
105
+
106
+ if [ ! -d "core" ]; then
107
+ log_fail "Missing core directory"
108
+ exit 1
109
+ fi
110
+
111
+ if [ ! -f "core/templates/project/project-config.yaml" ] ||
112
+ [ ! -f "core/templates/project/project-structure.yaml" ]; then
113
+ log_fail "Missing core project templates"
114
+ exit 1
115
+ fi
116
+
117
+ mkdir -p config
118
+ copy_if_missing "core/templates/project/project-config.yaml" "config/project-config.yaml"
119
+ copy_if_missing "core/templates/project/project-structure.yaml" "config/project-structure.yaml"
120
+ copy_if_missing "core/templates/project/docs-policy.json" "config/docs-policy.json"
121
+ copy_if_missing "core/templates/project/CODEOWNERS" "CODEOWNERS"
122
+
123
+ for dir in \
124
+ project/tickets \
125
+ project/backlog \
126
+ project/bugs \
127
+ project/sprints \
128
+ project/releases \
129
+ project/metrics \
130
+ project/views \
131
+ project/test-runs \
132
+ project/verifications \
133
+ project/incidents \
134
+ project/prs \
135
+ docs/project/product \
136
+ docs/project/planning \
137
+ docs/project/specs \
138
+ docs/project/user-stories \
139
+ docs/project/plans \
140
+ docs/project/requirements \
141
+ docs/project/api \
142
+ docs/runtime/refactor \
143
+ docs/runtime/adr \
144
+ docs/runtime/technical \
145
+ docs/runtime/runbooks \
146
+ docs/runtime/qa \
147
+ docs/runtime/test-runs \
148
+ docs/runtime/verifications \
149
+ docs/runtime/incidents; do
150
+ mkdir -p "$dir"
151
+ done
152
+ log_pass "Created required state and docs directories"
153
+
154
+ write_backlog_if_missing
155
+ touch project/audit-log.jsonl
156
+ touch project/user-requests.jsonl
157
+ install_framework_scripts
158
+ install_governance_workflow
159
+
160
+ if [ -f "core/scripts/sync-platforms.sh" ]; then
161
+ bash core/scripts/sync-platforms.sh
162
+ else
163
+ log_warn "Missing core/scripts/sync-platforms.sh; platform configs not synced"
164
+ fi
165
+
166
+ if [ -f "core/scripts/validate-state.sh" ]; then
167
+ bash core/scripts/validate-state.sh
168
+ else
169
+ log_warn "Missing core/scripts/validate-state.sh; skipped state validation"
170
+ fi
171
+
172
+ if [ -d ".githooks" ] && [ -f "scripts/install-hooks.sh" ]; then
173
+ log_info "Recommended next step: bash scripts/install-hooks.sh"
174
+ fi
175
+
176
+ echo ""
177
+ echo "========================================================"
178
+ echo -e " ${GREEN}AI Core project setup complete${NC}"
179
+ echo "========================================================"
180
+ echo ""
181
+ }
182
+
183
+ main "$@"