agent-manifesto-kit 0.0.0-development

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -0
  3. package/collection/NOTICE.md +36 -0
  4. package/collection/agents/code-reviewer.md +103 -0
  5. package/collection/agents/docs-manager.md +127 -0
  6. package/collection/bundles/kit-adopt/README.md +36 -0
  7. package/collection/bundles/kit-adopt/conventions/recommended-companions.md +43 -0
  8. package/collection/bundles/kit-adopt/pipelines/kit-adopt.md +52 -0
  9. package/collection/bundles/kit-adopt/skills/kit-adopt/SKILL.md +72 -0
  10. package/collection/bundles/sdd/README.md +50 -0
  11. package/collection/bundles/sdd/RECOMMENDS.md +21 -0
  12. package/collection/bundles/sdd/agents/sdd-gap-analyzer.md +79 -0
  13. package/collection/bundles/sdd/agents/sdd-spec-reviewer.md +75 -0
  14. package/collection/bundles/sdd/conventions/sdd-doc-set.md +136 -0
  15. package/collection/bundles/sdd/pipelines/sdd-adopt.md +60 -0
  16. package/collection/bundles/sdd/pipelines/sdd-bootstrap.md +60 -0
  17. package/collection/bundles/sdd/skills/sdd-doc-author/SKILL.md +69 -0
  18. package/collection/bundles/sdd/skills/sdd-feature-author/SKILL.md +71 -0
  19. package/collection/bundles/sdd/skills/sdd-index-sync/SKILL.md +61 -0
  20. package/collection/bundles/sdd/templates/docs/INDEX.md +35 -0
  21. package/collection/bundles/sdd/templates/docs/api.md +23 -0
  22. package/collection/bundles/sdd/templates/docs/architecture.md +42 -0
  23. package/collection/bundles/sdd/templates/docs/db.md +22 -0
  24. package/collection/bundles/sdd/templates/docs/decisions/ADR-template.md +24 -0
  25. package/collection/bundles/sdd/templates/docs/design.md +43 -0
  26. package/collection/bundles/sdd/templates/docs/idea.md +46 -0
  27. package/collection/bundles/sdd/templates/docs/operations.md +28 -0
  28. package/collection/bundles/sdd/templates/docs/roadmap.md +26 -0
  29. package/collection/bundles/sdd/templates/docs/security.md +24 -0
  30. package/collection/bundles/sdd/templates/docs/testing.md +34 -0
  31. package/collection/bundles/sdd/templates/features/F000_template/requirements.md +38 -0
  32. package/collection/bundles/sdd/templates/features/F000_template/scenarios.md +26 -0
  33. package/collection/bundles/sdd/templates/features/F000_template/tasks.md +11 -0
  34. package/collection/skills/brainstorm/SKILL.md +46 -0
  35. package/collection/skills/business-analyst/SKILL.md +58 -0
  36. package/collection/skills/documentation-maintenance/SKILL.md +60 -0
  37. package/collection/skills/explain-code/SKILL.md +81 -0
  38. package/collection/skills/frontend-audit/SKILL.md +135 -0
  39. package/collection/skills/frontend-impeccable-design/SKILL.md +135 -0
  40. package/collection/skills/frontend-impeccable-polish/SKILL.md +118 -0
  41. package/collection/skills/implement-feature/SKILL.md +99 -0
  42. package/collection/skills/memory-management/SKILL.md +75 -0
  43. package/collection/skills/meta-tags-optimizer/SKILL.md +73 -0
  44. package/collection/skills/pencil-design/SKILL.md +83 -0
  45. package/collection/skills/playwright-cli/SKILL.md +104 -0
  46. package/collection/skills/prepare-release-notes/SKILL.md +109 -0
  47. package/collection/skills/refactor-code/SKILL.md +104 -0
  48. package/collection/skills/review-code/SKILL.md +98 -0
  49. package/collection/skills/schema-markup-generator/SKILL.md +80 -0
  50. package/collection/skills/task-complete/SKILL.md +79 -0
  51. package/collection/skills/task-discovery/SKILL.md +69 -0
  52. package/collection/skills/task-validation/SKILL.md +71 -0
  53. package/collection/skills/test-review/SKILL.md +72 -0
  54. package/collection/skills/test-writer/SKILL.md +78 -0
  55. package/collection/skills/work-with-git/SKILL.md +154 -0
  56. package/dist/catalog.js +146 -0
  57. package/dist/cli.js +108 -0
  58. package/dist/commands/adopt.js +100 -0
  59. package/dist/commands/lint.js +26 -0
  60. package/dist/commands/list.js +30 -0
  61. package/dist/portability.js +41 -0
  62. package/dist/providers.js +37 -0
  63. package/package.json +49 -0
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: task-discovery
3
+ description: Gathers task context and identifies constraints before implementation begins. Use during discovery workflow steps to systematically understand the scope before acting.
4
+ ---
5
+
6
+ ## Scope
7
+
8
+ - Systematically gather task context and identify constraints before non-trivial implementation work begins. Prevent scope surprises and ensure the implementation plan is grounded in actual code state.
9
+ - Examine relevant files and dependencies, existing code patterns and conventions, architecture, contracts, module boundaries, and risk areas.
10
+
11
+ ## Prerequisites
12
+
13
+ Before discovery, confirm:
14
+ - The user request describes a task, feature, bug, refactor, or implementation goal to investigate.
15
+ - The relevant repository context can be read.
16
+ - Discovery can proceed without modifying files.
17
+ - Discovery can produce context, constraints, risks, and open questions.
18
+
19
+ If the task target is unclear, ask the smallest clarifying question before reading broadly.
20
+
21
+ ## Safety Constraints
22
+
23
+ - Do not edit, create, delete, stage, or commit files during discovery.
24
+ - Do not infer contracts, ownership, or intended behavior from names alone; label unsupported conclusions as assumptions.
25
+ - Do not expand discovery into implementation planning beyond identifying context, constraints, risks, and open questions.
26
+
27
+ ## Stop Conditions
28
+
29
+ - Stop and report discovery as blocked when the task goal, scope, or likely entry points cannot be identified from provided context.
30
+ - Stop and report blocked when required files, dependencies, or project documentation cannot be read.
31
+ - Stop and ask for clarification when multiple plausible scopes exist and choosing one would materially change the findings.
32
+ - Stop when continuing would require making product, architecture, or implementation decisions instead of discovering context.
33
+
34
+ ## Procedure
35
+
36
+ 1. Identify the files and components directly relevant to the task.
37
+ 2. Map dependencies and calling code that may be affected.
38
+ 3. Note existing patterns and conventions in the affected area.
39
+ 4. Identify contracts, invariants, architectural boundaries, and risk areas.
40
+ 5. Report findings as context and constraints.
41
+
42
+ When several entry points could match the request, inspect the most directly named area first and state that chosen scope. If two or more scopes are equally plausible and would produce different discovery results, stop and ask for clarification.
43
+
44
+ ## Verification
45
+
46
+ Before emitting discovery output, verify:
47
+ - Each context claim is supported by a source read or clearly marked as an assumption.
48
+ - Relevant dependencies, callers, tests, or docs were checked when they affect scope.
49
+ - Open questions contain only gaps that affect implementation scope, correctness, or risk.
50
+
51
+ ## Output Contract
52
+
53
+ Emit:
54
+
55
+ `Skill: task-discovery - output below`
56
+
57
+ Then include:
58
+
59
+ | Field | Content |
60
+ | --- | --- |
61
+ | Status | `completed`, `skipped`, or `blocked` |
62
+ | Task Scope | Task, feature, bug, refactor, or area investigated |
63
+ | Sources Read | Files, docs, tests, commands, or evidence inspected |
64
+ | Context | Relevant code segments, dependency information, and patterns observed |
65
+ | Constraints / Risks | Contracts, boundaries, invariants, risk areas, or `none` |
66
+ | Assumptions | Inferences used, or `none` |
67
+ | Open Questions / Blockers | Clarifications or unreadable context, or `none` |
68
+
69
+ Use `blocked` when important context cannot be inspected. Record partial findings under `Context` and remaining gaps under `Open Questions / Blockers`.
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: task-validation
3
+ description: Validates that the solution meets requirements and has no regressions. Use after implementation and before task closure.
4
+ ---
5
+
6
+ ## Scope
7
+
8
+ - Confirm that the completed implementation satisfies original requirements and does not introduce regressions.
9
+ - Use as the validation step after implementation is complete and before task closure.
10
+
11
+ ## Prerequisites
12
+
13
+ Before validating, confirm:
14
+ - The original requirements, acceptance criteria, or requested outcome are available.
15
+ - The completed implementation, changed files, diff, or artifact set can be inspected.
16
+ - The expected validation checks are known from the routed plan, project conventions, package scripts, docs, or repository evidence.
17
+ - The environment can run at least one meaningful automated or manual validation check.
18
+
19
+ ## Safety Constraints
20
+
21
+ - Do not modify files, update snapshots, regenerate artifacts, or change test expectations during validation.
22
+ - Do not mark validation as passed from raw command output alone; summarize the gate, evidence, and result.
23
+ - Do not ignore failing checks because they appear unrelated unless the reason is stated.
24
+ - Do not invent acceptance criteria or validation coverage not supported by the request or repository evidence.
25
+
26
+ ## Stop Conditions
27
+
28
+ - If tests cannot execute due to environment or configuration issues (missing runner, broken setup, missing dependencies), do not report `fail` — report `blocked` and describe the blocker.
29
+ - Stop and report `blocked` when original requirements or acceptance criteria cannot be identified.
30
+ - Stop and report `blocked` when the implementation or affected surface cannot be inspected.
31
+ - Stop and report `blocked` when required tests or checks cannot run because of missing dependencies, broken setup, unavailable services, or missing credentials.
32
+ - Stop and report `blocked` when no meaningful validation path is available for the changed behavior.
33
+ - Stop and report `blocked` when a planned validation gate was skipped without a reason.
34
+
35
+ ## Procedure
36
+
37
+ 1. Verify the implementation matches the original requirements.
38
+ 2. Run the selected automated or manual validation checks and record pass, fail, skipped, or blocked status.
39
+ 3. Check for regressions in affected areas.
40
+ 4. Report validation result as **pass**, **fail**, or **blocked**, with any issues found.
41
+
42
+ Choose the smallest meaningful validation set that covers the changed behavior and likely regressions. If several validation paths are plausible and differ materially in confidence or cost, state the chosen path and why; if no path is clearly adequate, report blocked.
43
+
44
+ ## Verification
45
+
46
+ Before emitting the validation result, verify:
47
+ - Every original requirement or acceptance criterion was checked, marked not applicable, or listed as blocked.
48
+ - Each changed or affected area has at least one relevant validation signal.
49
+ - Failures distinguish implementation defects from environment/setup blockers.
50
+ - Skipped checks include a concrete reason and residual risk.
51
+
52
+ ## Output Contract
53
+
54
+ Emit:
55
+
56
+ `Skill: task-validation - output below`
57
+
58
+ Then include:
59
+
60
+ | Field | Content |
61
+ | --- | --- |
62
+ | Overall Result | `pass`, `fail`, or `blocked` |
63
+ | Scope | Requirement, feature, fix, refactor, or artifact set validated |
64
+ | Requirements Checked | Requirements or acceptance criteria checked, marked not applicable, or blocked reason |
65
+ | Validation Gates | Each gate with status `pass`, `fail`, `skipped`, or `blocked` |
66
+ | Evidence | Commands, tests, inspections, or scenario checks performed |
67
+ | Issues Found | Failures or regressions, or `none` |
68
+ | Assumptions | Inferences used, or `none` |
69
+ | Blockers | Missing context, environment issue, or unavailable check, or `none` |
70
+
71
+ `Overall Result` may be `pass` only when all required validation gates passed and any skipped gates are explicitly justified and non-blocking.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: test-review
3
+ description: Reviews and strengthens tests during the TDD green or refactor phase. Use after initial tests pass to ensure comprehensive coverage before handoff.
4
+ ---
5
+
6
+ ## Scope
7
+
8
+ - Review tests after the initial implementation passes. Identify coverage, maintainability, flakiness, and convention issues before the task is closed.
9
+ - Use after baseline tests pass or validation evidence is available to evaluate test quality.
10
+
11
+ ## Prerequisites
12
+
13
+ Before reviewing tests, confirm:
14
+ - The test files, diff, branch, or artifact set in scope can be identified and read.
15
+ - The code under test can be inspected.
16
+ - Initial test validation has passed, or the current validation result is available.
17
+ - Relevant project test conventions, commands, and expected behavior can be inspected.
18
+
19
+ If the scope is unclear, ask the smallest clarifying question before reviewing.
20
+
21
+ ## Safety Constraints
22
+
23
+ - Do not edit, create, delete, stage, or commit files.
24
+ - Do not add, remove, or refactor tests during test review.
25
+ - Do not change production code or test expectations.
26
+ - Do not invent coverage claims that are not supported by inspected tests, code, or validation output.
27
+
28
+ ## Stop Conditions
29
+
30
+ Stop and report the review as blocked when a prerequisite remains unavailable after minimal clarification, or when the requested action violates Safety Constraints.
31
+
32
+ ## Procedure
33
+
34
+ 1. Confirm scoped tests have current passing validation evidence when available.
35
+ 2. Identify edge cases and regression scenarios not covered during initial test creation.
36
+ 3. Recommend missing test cases for edge scenarios, error paths, and boundary conditions.
37
+ 4. Identify readability and maintainability improvements while preserving existing behavior.
38
+ 5. Evaluate overall test coverage and identify any remaining gaps.
39
+
40
+ Evaluate tests on:
41
+ - correctness: the test verifies the behavior it claims to protect
42
+ - maintainability: setup, naming, assertions, and fixtures are clear and localized
43
+ - simplicity and duplication risk: repeated setup, helpers, or cases are flagged only when they obscure behavior, increase maintenance risk, or create behavior-drift risk
44
+ - flakiness risk: timing, ordering, external services, randomness, filesystem, network, or environment coupling
45
+ - convention alignment: file placement, naming, structure, and project test patterns
46
+
47
+ ## Verification
48
+
49
+ Before emitting the review, verify:
50
+ - Each finding is tied to a specific test, assertion, setup pattern, or missing behavior.
51
+ - Findings distinguish confirmed defects from risks and open questions.
52
+ - Recommended additions describe the scenario and expected assertion, not implementation steps.
53
+ - Remaining coverage gaps are explicit and not presented as completed work.
54
+
55
+ ## Output Contract
56
+
57
+ Emit:
58
+
59
+ `Skill: test-review - output below`
60
+
61
+ Then include:
62
+
63
+ | Field | Content |
64
+ | --- | --- |
65
+ | Status | `completed`, `skipped`, or `blocked` |
66
+ | Scope | Test files, diff, branch, or artifact set reviewed |
67
+ | Sources Read | Tests, code under test, docs, conventions, or validation evidence inspected |
68
+ | Initial Test Status | Passing, failing, unavailable, or not applicable |
69
+ | Findings | Prioritized findings for correctness, maintainability, flakiness, and convention alignment |
70
+ | Recommended Additions | Missing edge cases, regression scenarios, or assertions, or `none` |
71
+ | Assumptions | Inferences used, or `none` |
72
+ | Blockers | Missing scope, unreadable context, unavailable validation, or `none` |
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: test-writer
3
+ description: Writes tests before production code changes (TDD red phase). Use when establishing the test contract for a new feature or bug fix.
4
+ ---
5
+
6
+ ## Scope
7
+
8
+ - Implement the TDD red phase by writing failing tests that express the desired behavior before any production code is changed.
9
+
10
+ ## Prerequisites
11
+
12
+ Before writing tests, confirm:
13
+ - The user requested or approved TDD red-phase test creation.
14
+ - The desired behavior, bug reproduction, or acceptance criteria are clear enough to express as tests.
15
+ - Production code for the behavior has not already been changed in this task.
16
+ - Relevant test framework, existing test patterns, commands, and code under test can be inspected.
17
+ - Tests can be added without overwriting unrelated user work.
18
+
19
+ If any item is false, stop and report what is missing.
20
+
21
+ ## Safety Constraints
22
+
23
+ - Do not edit production code during test writing.
24
+ - Do not change existing passing tests, fixtures, snapshots, or expectations unless required to express the approved new behavior.
25
+ - Do not make tests fail through invalid setup, syntax errors, missing imports, timing assumptions, or intentionally broken assertions.
26
+ - Do not invent requirements, edge cases, permissions, defaults, or user-facing behavior not supported by user input or repository evidence.
27
+ - Do not overwrite unrelated user changes.
28
+
29
+ ## Stop Conditions
30
+
31
+ - Stop and report test writing as blocked when the expected behavior cannot be stated as observable assertions.
32
+ - Stop and report blocked when required test context, fixtures, commands, or code under test cannot be read.
33
+ - Stop and report blocked when the test runner cannot execute because of configuration, dependency, environment, or credential issues.
34
+ - Stop and report blocked when production code has already been changed and the work is no longer a TDD red phase.
35
+ - Stop and report blocked when creating the tests would require changing production code, product decisions, schemas, external services, or unrelated tests.
36
+
37
+ ## Procedure
38
+
39
+ 1. Review available requirements, acceptance criteria, bug reproduction, or discovery notes.
40
+ 2. Identify expected behaviors and edge cases to cover.
41
+ 3. Create test cases that express the desired behavior.
42
+ 4. Run tests to confirm they fail initially (red phase confirmed).
43
+ 5. Investigate any passing new tests and classify them as already-covered behavior or incomplete red-phase evidence.
44
+ 6. Document failing tests as the implementation contract.
45
+
46
+ When multiple test scopes or assertion styles are plausible, choose the one that matches existing project test patterns and the smallest observable behavior contract. If multiple scopes are equally plausible and would test different behavior, stop and ask for clarification.
47
+
48
+ ## Verification
49
+
50
+ Before reporting completion, verify:
51
+ - Each new test maps to a stated requirement, acceptance criterion, or bug reproduction.
52
+ - The failure reason demonstrates missing behavior rather than broken test setup.
53
+ - Existing unrelated tests were not changed or invalidated without explanation.
54
+ - Any passing new test is explained as already-covered behavior or incomplete red-phase evidence.
55
+
56
+ ## Output Contract
57
+
58
+ Emit:
59
+
60
+ `Skill: test-writer - output below`
61
+
62
+ Then include:
63
+
64
+ | Field | Content |
65
+ | --- | --- |
66
+ | Status | `completed`, `skipped`, or `blocked` |
67
+ | Scope | Feature, bug, behavior, or contract covered |
68
+ | Test Files | Created or modified test files, or `none` |
69
+ | Sources Read | Requirements, code, tests, docs, or commands inspected |
70
+ | Red Phase Contract | Failing test cases and the behavior each asserts |
71
+ | Red Phase Evidence | Test command run and failure reason |
72
+ | Assumptions | Inferences used, or `none` |
73
+ | Coverage Gaps | Known missing cases, or `none` |
74
+ | Blockers | Missing context, unavailable runner, or non-red-phase state, or `none` |
75
+
76
+ Use `completed` only when newly written tests fail for the intended unmet behavior, not setup or syntax errors.
77
+
78
+ Use `blocked` when approved test cases cannot be red-confirmed; list red-confirmed cases in `Red Phase Evidence` and blocked cases in `Coverage Gaps` and `Blockers`.
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: work-with-git
3
+ description: Handles all git operations for a task — branch creation, diff, staging, commit, and push. Do not commit or push unless the user explicitly asks.
4
+ ---
5
+
6
+ ## Scope
7
+
8
+ - Perform git operations for a task: inspect state, create branches, stage files, commit, push, and report.
9
+
10
+ ## Prerequisites
11
+
12
+ Before running git operations, confirm:
13
+ - Requires the Git CLI: <https://git-scm.com/docs/git>.
14
+ - Git is available; verify with `git --version`. If unavailable, stop and ask the user to install Git or provide another environment.
15
+ - The current directory is inside a git worktree.
16
+ - The current branch or detached-HEAD state is known.
17
+ - `git status --short` has been inspected.
18
+ - The requested operation is clear: inspect, branch, stage, commit, push, or another named git action.
19
+ - Any operation that can change repository state has explicit user approval when required by this skill.
20
+
21
+ If the repository, branch state, or requested operation is unclear, stop and ask for the missing input.
22
+
23
+ ## Safety Constraints
24
+
25
+ - Do NOT commit unless the user explicitly asks for a commit.
26
+ - Do NOT push unless the user explicitly asks for a push.
27
+ - Do NOT switch branches or pull when uncommitted changes exist without checking with the user first.
28
+ - Do NOT force-push or rewrite history without explicit user permission.
29
+ - Treat direct pushes to `main` as requiring explicit user approval.
30
+ - Do not use broad staging commands such as `git add -A` or `git add .` unless the user explicitly approved staging every changed file.
31
+ - Do not discard, overwrite, stash, reset, clean, or restore user changes without explicit approval.
32
+ - Do not create, delete, rewrite, or move tags unless the user explicitly requested that exact tag operation.
33
+ - Do not run merge, rebase, pull, or branch switch operations with uncommitted changes unless the user explicitly approved the risk.
34
+ - Do not use `--force`; if force push is explicitly approved, prefer `--force-with-lease` and report the exact remote and branch.
35
+
36
+ ## Stop Conditions
37
+
38
+ Stop and ask before proceeding when:
39
+ - The repo is not a git worktree.
40
+ - HEAD is detached and the user requested commit, branch, pull, merge, rebase, or push.
41
+ - The base branch cannot be determined.
42
+ - The staging scope is unclear or includes unrelated files.
43
+ - A commit is requested but no relevant staged or stageable task changes exist.
44
+ - A push is requested but the target remote, branch, or upstream is unclear.
45
+
46
+ ## Procedure
47
+
48
+ 1. Do not assume the correct base branch. Run `git status --short` and `git branch --show-current` first.
49
+ 2. Run `git status` to review all modified and untracked files.
50
+ 3. Run `git diff` to confirm the changes match what was planned.
51
+ 4. Stage only files relevant to the current task — never use `git add -A` blindly.
52
+ 5. Perform one consequential git operation at a time, then inspect state before the next operation. Do not chain staging, committing, and pushing into a single unchecked command sequence.
53
+
54
+ ### Branch Creation
55
+
56
+ When branch creation is requested, use the task classification already stated by the caller when available. If branch choice depends on task classification and classification is absent, ask for the missing input instead of classifying the task inside this skill.
57
+
58
+ #### 1. Check For Uncommitted Changes
59
+
60
+ Run `git status --porcelain`. If any uncommitted changes exist, stop immediately and ask:
61
+
62
+ > There are uncommitted changes on `<current-branch>`. Commit, stash, or abort before continuing?
63
+
64
+ Do not proceed until the user resolves this.
65
+
66
+ #### 2. Determine Whether A Branch Is Needed
67
+
68
+ | Current branch | Task | Action |
69
+ | --- | --- | --- |
70
+ | `main` or `master` | Trivial | Skip |
71
+ | `main` or `master` | Non-trivial | Create silently |
72
+ | Feature branch | Trivial | Skip |
73
+ | Feature branch | Related to current branch | Skip — continue on current branch |
74
+ | Feature branch | Unrelated, non-trivial | Ask before creating |
75
+ | Any | User explicitly requested | Create silently |
76
+
77
+ #### 3. Create The Branch
78
+
79
+ Detect the default remote branch first when a remote is available:
80
+ ```bash
81
+ git fetch origin
82
+ git remote show origin | grep "HEAD branch"
83
+ ```
84
+
85
+ Then create from it:
86
+ ```bash
87
+ git checkout -b <branch-name> origin/<default-branch>
88
+ ```
89
+
90
+ If no remote or default remote branch is available, ask the user which base ref to use instead of treating local-only branch creation as blocked.
91
+
92
+ State the outcome before proceeding:
93
+ - **Skipped**: `<reason>`
94
+ - **Created**: `<branch-name>` from `origin/<default-branch>` or approved local base ref
95
+ - **Blocked**: uncommitted changes — waiting for user resolution
96
+
97
+ ### Commit Rules
98
+
99
+ When the user explicitly asks for a commit:
100
+ - Write a commit message that explains *why* the change was made, not just what changed.
101
+ - Commit only staged files relevant to the current task.
102
+
103
+ ## Branch Naming
104
+
105
+ New branches must use one of these prefixes:
106
+
107
+ | Prefix | Purpose |
108
+ | --- | --- |
109
+ | `feature/<name>` | New features |
110
+ | `fix/<name>` | Bug corrections |
111
+ | `refactor/<name>` | Behavior-preserving restructuring |
112
+ | `chore/<name>` | Maintenance, config, or tooling |
113
+ | `docs/<name>` | Documentation updates |
114
+
115
+ Name format: `<prefix><slugified-task-description>`
116
+
117
+ Slugify: lowercase; spaces and special characters replaced with hyphens; no leading or trailing hyphens.
118
+
119
+ ## Error Handling
120
+
121
+ When any git command fails (push rejected, merge conflict, remote error, authentication error):
122
+ - Stop immediately.
123
+ - Report the exact error message to the user.
124
+ - Do not attempt recovery — resolution requires explicit user instruction.
125
+
126
+ ## Verification
127
+
128
+ Before reporting completion, verify:
129
+ - After staging, `git diff --cached --name-only` contains only task-relevant files.
130
+ - After committing, `git status --short` and the new commit hash were inspected.
131
+ - After pushing, the pushed remote and branch are known.
132
+ - Any skipped or blocked operation is reported with the reason.
133
+
134
+ ## Output Contract
135
+
136
+ Emit:
137
+
138
+ `Skill: work-with-git - output below`
139
+
140
+ Then include:
141
+
142
+ | Field | Content |
143
+ | --- | --- |
144
+ | Status | `completed`, `skipped`, or `blocked` |
145
+ | Operation | Git action requested and performed |
146
+ | Branch State | Current branch or detached HEAD |
147
+ | Working Tree | Clean, dirty, or blocked summary |
148
+ | Staged Files | Files staged, or `none` |
149
+ | Commit | Commit hash and message, or `none` |
150
+ | Push | Remote/branch pushed, or `none` |
151
+ | Assumptions | Inferences used, or `none` |
152
+ | Blockers / Errors | Git error, missing approval, unclear scope, or `none` |
153
+
154
+ If no commit or push occurred, state that explicitly.
@@ -0,0 +1,146 @@
1
+ import { readFileSync, readdirSync, existsSync } from "node:fs";
2
+ import { join, dirname, basename } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ /** Package root = the directory containing both `dist/` (or `src/`) and `collection/`. */
5
+ export function packageRoot() {
6
+ const here = dirname(fileURLToPath(import.meta.url));
7
+ return dirname(here);
8
+ }
9
+ function collectionDir() {
10
+ return join(packageRoot(), "collection");
11
+ }
12
+ function bundlesDir() {
13
+ return join(collectionDir(), "bundles");
14
+ }
15
+ function parseFrontmatter(text) {
16
+ const out = {};
17
+ const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
18
+ if (!match)
19
+ return out;
20
+ for (const line of match[1].split(/\r?\n/)) {
21
+ const idx = line.indexOf(":");
22
+ if (idx === -1)
23
+ continue;
24
+ const key = line.slice(0, idx).trim();
25
+ const val = line.slice(idx + 1).trim().replace(/^["']|["']$/g, "");
26
+ if (key)
27
+ out[key] = val;
28
+ }
29
+ return out;
30
+ }
31
+ /** Files without frontmatter (pipelines, conventions): name from filename, description from `## Purpose`. */
32
+ function headingMeta(text, file) {
33
+ const name = basename(file, ".md");
34
+ let description = "";
35
+ const idx = text.indexOf("## Purpose");
36
+ if (idx !== -1) {
37
+ const after = text.slice(idx + "## Purpose".length);
38
+ description = after.split("\n").map((l) => l.trim()).find((l) => l.length > 0) ?? "";
39
+ }
40
+ return { name, description };
41
+ }
42
+ /** First paragraph of a README, used as a bundle's description. */
43
+ function readmeSummary(dir) {
44
+ const file = join(dir, "README.md");
45
+ if (!existsSync(file))
46
+ return "";
47
+ const lines = readFileSync(file, "utf8").split("\n");
48
+ let i = 0;
49
+ while (i < lines.length && (lines[i].trim() === "" || lines[i].startsWith("#")))
50
+ i++;
51
+ const para = [];
52
+ while (i < lines.length && lines[i].trim() !== "") {
53
+ para.push(lines[i].trim());
54
+ i++;
55
+ }
56
+ return para.join(" ");
57
+ }
58
+ /** Scan one capability-type directory inside a base (collection root or a bundle). */
59
+ function scanTypeDir(base, type, bundle) {
60
+ const caps = [];
61
+ if (type === "skill") {
62
+ const dir = join(base, "skills");
63
+ if (!existsSync(dir))
64
+ return caps;
65
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
66
+ if (!entry.isDirectory())
67
+ continue;
68
+ const skillDir = join(dir, entry.name);
69
+ const file = join(skillDir, "SKILL.md");
70
+ if (!existsSync(file))
71
+ continue;
72
+ const fm = parseFrontmatter(readFileSync(file, "utf8"));
73
+ caps.push({
74
+ type: "skill",
75
+ name: fm.name ?? entry.name,
76
+ description: fm.description ?? "",
77
+ sourcePath: file,
78
+ sourceCopyPath: skillDir,
79
+ isDir: true,
80
+ bundle,
81
+ });
82
+ }
83
+ return caps;
84
+ }
85
+ const sub = type === "agent" ? "agents" : type === "pipeline" ? "pipelines" : "conventions";
86
+ const dir = join(base, sub);
87
+ if (!existsSync(dir))
88
+ return caps;
89
+ for (const f of readdirSync(dir)) {
90
+ if (!f.endsWith(".md"))
91
+ continue;
92
+ const file = join(dir, f);
93
+ const text = readFileSync(file, "utf8");
94
+ const fm = parseFrontmatter(text);
95
+ const fallback = type === "agent" ? { name: basename(f, ".md"), description: "" } : headingMeta(text, f);
96
+ caps.push({
97
+ type,
98
+ name: fm.name ?? fallback.name,
99
+ description: fm.description ?? fallback.description,
100
+ sourcePath: file,
101
+ sourceCopyPath: file,
102
+ isDir: false,
103
+ bundle,
104
+ });
105
+ }
106
+ return caps;
107
+ }
108
+ const ALL_TYPES = ["skill", "agent", "pipeline", "convention"];
109
+ /** Bundles found under collection/bundles/, each a cohesive, independently adoptable unit. */
110
+ export function scanBundles() {
111
+ const root = bundlesDir();
112
+ if (!existsSync(root))
113
+ return [];
114
+ const bundles = [];
115
+ for (const entry of readdirSync(root, { withFileTypes: true })) {
116
+ if (!entry.isDirectory())
117
+ continue;
118
+ const dir = join(root, entry.name);
119
+ const items = ALL_TYPES.flatMap((t) => scanTypeDir(dir, t, entry.name));
120
+ const recommends = join(dir, "RECOMMENDS.md");
121
+ bundles.push({
122
+ name: entry.name,
123
+ description: readmeSummary(dir),
124
+ dir,
125
+ recommendsPath: existsSync(recommends) ? recommends : undefined,
126
+ items,
127
+ });
128
+ }
129
+ return bundles;
130
+ }
131
+ /** All individually addressable capabilities: flat collection items plus every bundle's items. */
132
+ export function scanCatalog() {
133
+ const root = collectionDir();
134
+ const flat = ALL_TYPES.flatMap((t) => scanTypeDir(root, t));
135
+ const bundled = scanBundles().flatMap((b) => b.items);
136
+ return [...flat, ...bundled];
137
+ }
138
+ export function findCapability(name) {
139
+ const matches = scanCatalog().filter((c) => c.name === name);
140
+ if (matches.length === 1)
141
+ return { match: matches[0], ambiguous: [] };
142
+ return { ambiguous: matches.length > 1 ? matches : [] };
143
+ }
144
+ export function findBundle(name) {
145
+ return scanBundles().find((b) => b.name === name);
146
+ }