pi-evalset-lab 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.
- package/.copier-answers.yml +5 -0
- package/.githooks/pre-commit +12 -0
- package/.github/CODEOWNERS +12 -0
- package/.github/ISSUE_TEMPLATE/bug-report.yml +63 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/docs.yml +39 -0
- package/.github/ISSUE_TEMPLATE/feature-request.yml +41 -0
- package/.github/VOUCHED.td +8 -0
- package/.github/dependabot.yml +13 -0
- package/.github/pull_request_template.md +34 -0
- package/.github/workflows/ci.yml +37 -0
- package/.github/workflows/publish.yml +60 -0
- package/.github/workflows/release-please.yml +25 -0
- package/.github/workflows/vouch-check-pr.yml +29 -0
- package/.github/workflows/vouch-manage.yml +34 -0
- package/.pi/extensions/startup-intake-router.ts +151 -0
- package/.pi/prompts/init-project-docs.md +32 -0
- package/.release-please-config.json +11 -0
- package/.release-please-manifest.json +3 -0
- package/AGENTS.md +39 -0
- package/CHANGELOG.md +43 -0
- package/CODE_OF_CONDUCT.md +50 -0
- package/CONTRIBUTING.md +28 -0
- package/NEXT_SESSION_PROMPT.md +14 -0
- package/README.md +246 -0
- package/SECURITY.md +34 -0
- package/SUPPORT.md +37 -0
- package/docs/dev/CONTRIBUTING.md +37 -0
- package/docs/dev/EXTENSION_SOP.md +43 -0
- package/docs/dev/next_steps.md +17 -0
- package/docs/dev/plans/001-initial-plan.md +24 -0
- package/docs/dev/status.md +21 -0
- package/docs/org/operating_model.md +39 -0
- package/docs/org/project-docs-intake.questions.json +60 -0
- package/docs/project/foundation.md +28 -0
- package/docs/project/incentives.md +17 -0
- package/docs/project/resources.md +26 -0
- package/docs/project/skills.md +17 -0
- package/docs/project/strategic_goals.md +18 -0
- package/docs/project/tactical_goals.md +39 -0
- package/docs/project/vision.md +21 -0
- package/examples/.gitkeep +0 -0
- package/examples/fixed-task-set-v2.json +127 -0
- package/examples/fixed-task-set-v3.json +126 -0
- package/examples/fixed-task-set.json +22 -0
- package/examples/system-baseline.txt +1 -0
- package/examples/system-candidate.txt +6 -0
- package/extensions/evalset.ts +1090 -0
- package/external/.gitkeep +0 -0
- package/ontology/.gitkeep +0 -0
- package/package.json +31 -0
- package/policy/security-policy.json +10 -0
- package/prek.toml +15 -0
- package/prompts/implementation-planning.md +17 -0
- package/prompts/init-project-docs.md +32 -0
- package/prompts/security-review.md +17 -0
- package/scripts/docs-list.sh +50 -0
- package/scripts/init-project-docs.sh +56 -0
- package/scripts/install-hooks.sh +13 -0
- package/scripts/sync-to-live.sh +91 -0
- package/scripts/validate-structure.sh +325 -0
- package/src/.gitkeep +0 -0
- package/tests/.gitkeep +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
|
|
6
|
+
if command -v prek >/dev/null 2>&1; then
|
|
7
|
+
(cd "$ROOT_DIR" && prek run --hook-stage pre-commit)
|
|
8
|
+
elif [[ -x "$ROOT_DIR/node_modules/.bin/prek" ]]; then
|
|
9
|
+
(cd "$ROOT_DIR" && "$ROOT_DIR/node_modules/.bin/prek" run --hook-stage pre-commit)
|
|
10
|
+
else
|
|
11
|
+
"$ROOT_DIR/scripts/validate-structure.sh"
|
|
12
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Default owner for generated repositories. Update if you use a different maintainer/team.
|
|
2
|
+
|
|
3
|
+
* @tryingET
|
|
4
|
+
|
|
5
|
+
/.github/workflows/* @tryingET
|
|
6
|
+
/.github/ISSUE_TEMPLATE/* @tryingET
|
|
7
|
+
/.github/VOUCHED.td @tryingET
|
|
8
|
+
/extensions/* @tryingET
|
|
9
|
+
/package.json @tryingET
|
|
10
|
+
/SECURITY.md @tryingET
|
|
11
|
+
/.release-please-config.json @tryingET
|
|
12
|
+
/.release-please-manifest.json @tryingET
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a reproducible defect.
|
|
3
|
+
labels: ["bug", "needs-triage"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for reporting a bug.
|
|
9
|
+
Please provide a minimal reproduction and include exact versions.
|
|
10
|
+
|
|
11
|
+
- type: checkboxes
|
|
12
|
+
id: preflight
|
|
13
|
+
attributes:
|
|
14
|
+
label: Preflight
|
|
15
|
+
options:
|
|
16
|
+
- label: I searched existing issues and did not find a duplicate.
|
|
17
|
+
required: true
|
|
18
|
+
- label: I can reproduce this on the latest release.
|
|
19
|
+
required: true
|
|
20
|
+
|
|
21
|
+
- type: textarea
|
|
22
|
+
id: expected
|
|
23
|
+
attributes:
|
|
24
|
+
label: Expected behavior
|
|
25
|
+
description: What should happen?
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
|
|
29
|
+
- type: textarea
|
|
30
|
+
id: actual
|
|
31
|
+
attributes:
|
|
32
|
+
label: Actual behavior
|
|
33
|
+
description: What happened instead?
|
|
34
|
+
validations:
|
|
35
|
+
required: true
|
|
36
|
+
|
|
37
|
+
- type: textarea
|
|
38
|
+
id: reproduce
|
|
39
|
+
attributes:
|
|
40
|
+
label: Steps to reproduce
|
|
41
|
+
description: Include exact commands, inputs, and files.
|
|
42
|
+
placeholder: |
|
|
43
|
+
1. Run ...
|
|
44
|
+
2. Execute ...
|
|
45
|
+
3. Observe ...
|
|
46
|
+
validations:
|
|
47
|
+
required: true
|
|
48
|
+
|
|
49
|
+
- type: textarea
|
|
50
|
+
id: logs
|
|
51
|
+
attributes:
|
|
52
|
+
label: Logs and screenshots
|
|
53
|
+
description: Paste relevant logs/errors. Remove secrets before posting.
|
|
54
|
+
render: shell
|
|
55
|
+
|
|
56
|
+
- type: input
|
|
57
|
+
id: environment
|
|
58
|
+
attributes:
|
|
59
|
+
label: Environment
|
|
60
|
+
description: OS, runtime version, package version.
|
|
61
|
+
placeholder: "ubuntu-24.04, node 20.x, package 0.1.0"
|
|
62
|
+
validations:
|
|
63
|
+
required: true
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Security vulnerability reporting
|
|
4
|
+
url: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
|
|
5
|
+
about: Follow SECURITY.md and use private vulnerability reporting. Do not post exploit details publicly.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Documentation improvement
|
|
2
|
+
description: Request a docs clarification, correction, or new guide.
|
|
3
|
+
labels: ["docs", "needs-triage"]
|
|
4
|
+
body:
|
|
5
|
+
- type: checkboxes
|
|
6
|
+
id: preflight
|
|
7
|
+
attributes:
|
|
8
|
+
label: Preflight
|
|
9
|
+
options:
|
|
10
|
+
- label: I searched existing issues and did not find a duplicate docs request.
|
|
11
|
+
required: true
|
|
12
|
+
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: location
|
|
15
|
+
attributes:
|
|
16
|
+
label: Affected documentation
|
|
17
|
+
description: Link file/path/section that needs improvement.
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
|
|
21
|
+
- type: textarea
|
|
22
|
+
id: change
|
|
23
|
+
attributes:
|
|
24
|
+
label: Requested change
|
|
25
|
+
description: What should be clarified, corrected, or added?
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
|
|
29
|
+
- type: textarea
|
|
30
|
+
id: reason
|
|
31
|
+
attributes:
|
|
32
|
+
label: Why this matters
|
|
33
|
+
description: What confusion or failure does this currently cause?
|
|
34
|
+
|
|
35
|
+
- type: textarea
|
|
36
|
+
id: references
|
|
37
|
+
attributes:
|
|
38
|
+
label: Supporting references
|
|
39
|
+
description: Optional examples, screenshots, or related links.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest a new capability or improvement.
|
|
3
|
+
labels: ["enhancement", "needs-triage"]
|
|
4
|
+
body:
|
|
5
|
+
- type: checkboxes
|
|
6
|
+
id: preflight
|
|
7
|
+
attributes:
|
|
8
|
+
label: Preflight
|
|
9
|
+
options:
|
|
10
|
+
- label: I searched existing issues and did not find a duplicate request.
|
|
11
|
+
required: true
|
|
12
|
+
- label: This request describes one focused capability.
|
|
13
|
+
required: true
|
|
14
|
+
|
|
15
|
+
- type: textarea
|
|
16
|
+
id: problem
|
|
17
|
+
attributes:
|
|
18
|
+
label: Problem statement
|
|
19
|
+
description: What user or maintainer problem should be solved?
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: proposal
|
|
25
|
+
attributes:
|
|
26
|
+
label: Proposed solution
|
|
27
|
+
description: Describe the desired behavior and expected outcome.
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: alternatives
|
|
33
|
+
attributes:
|
|
34
|
+
label: Alternatives considered
|
|
35
|
+
description: What other options did you evaluate?
|
|
36
|
+
|
|
37
|
+
- type: textarea
|
|
38
|
+
id: additional
|
|
39
|
+
attributes:
|
|
40
|
+
label: Additional context
|
|
41
|
+
description: Links, examples, screenshots, or constraints.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Vouched (trusted) contributors list for this repository.
|
|
2
|
+
#
|
|
3
|
+
# Keep one handle per line, sorted alphabetically.
|
|
4
|
+
# Prefix with '-' to denounce a user and block contribution.
|
|
5
|
+
#
|
|
6
|
+
# Default maintainer bootstrap (adjust to your owner/team policy).
|
|
7
|
+
github:tryingET Initial repository owner
|
|
8
|
+
# github:co-maintainer Optional second maintainer
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "PR template for scoped changes with explicit validation."
|
|
3
|
+
read_when:
|
|
4
|
+
- "Opening a pull request for review."
|
|
5
|
+
system4d:
|
|
6
|
+
container: "Reviewer-ready pull request intake format."
|
|
7
|
+
compass: "Clarity, verification, and rollback awareness."
|
|
8
|
+
engine: "Summarize -> validate -> assess risk -> request review."
|
|
9
|
+
fog: "Integration side effects may appear after merge."
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Summary
|
|
13
|
+
|
|
14
|
+
- What changed?
|
|
15
|
+
- Why now?
|
|
16
|
+
|
|
17
|
+
## Validation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm run check
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Paste relevant output (and any additional checks) below.
|
|
24
|
+
|
|
25
|
+
## Risk and rollback
|
|
26
|
+
|
|
27
|
+
- Risk level: low / medium / high
|
|
28
|
+
- Rollback plan if this regresses production behavior:
|
|
29
|
+
|
|
30
|
+
## Checklist
|
|
31
|
+
|
|
32
|
+
- [ ] Scope is focused and reviewable.
|
|
33
|
+
- [ ] Docs/changelog updated when behavior changed.
|
|
34
|
+
- [ ] No secrets or credentials added.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
check:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v6
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v6
|
|
21
|
+
with:
|
|
22
|
+
node-version: "20"
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
if [[ -f package-lock.json ]]; then
|
|
27
|
+
npm ci
|
|
28
|
+
else
|
|
29
|
+
npm install --package-lock-only --ignore-scripts
|
|
30
|
+
npm ci
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
- name: Validate structure
|
|
34
|
+
run: npm run check
|
|
35
|
+
|
|
36
|
+
- name: npm pack dry run
|
|
37
|
+
run: npm pack --dry-run
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- published
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish-npm:
|
|
13
|
+
if: startsWith(github.event.release.tag_name, 'v')
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: npm-publish
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
id-token: write
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout
|
|
21
|
+
uses: actions/checkout@v6
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@v6
|
|
25
|
+
with:
|
|
26
|
+
node-version: "22"
|
|
27
|
+
registry-url: https://registry.npmjs.org
|
|
28
|
+
|
|
29
|
+
- name: Upgrade npm for trusted publishing
|
|
30
|
+
run: npm install --global npm@^11.5.1
|
|
31
|
+
|
|
32
|
+
- name: Validate release tag + package version
|
|
33
|
+
env:
|
|
34
|
+
TAG_NAME: ${{ github.event.release.tag_name }}
|
|
35
|
+
run: |
|
|
36
|
+
if [[ ! "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.]+)?$ ]]; then
|
|
37
|
+
echo "Release tag must match vX.Y.Z (optional prerelease/build suffix)." >&2
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
PKG_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version")"
|
|
42
|
+
if [[ "v${PKG_VERSION}" != "$TAG_NAME" ]]; then
|
|
43
|
+
echo "package.json version (${PKG_VERSION}) does not match release tag (${TAG_NAME})." >&2
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies
|
|
48
|
+
run: |
|
|
49
|
+
if [[ -f package-lock.json ]]; then
|
|
50
|
+
npm ci
|
|
51
|
+
else
|
|
52
|
+
npm install --package-lock-only --ignore-scripts
|
|
53
|
+
npm ci
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
- name: Validate structure
|
|
57
|
+
run: npm run check
|
|
58
|
+
|
|
59
|
+
- name: Publish to npm (OIDC + provenance)
|
|
60
|
+
run: npm publish --provenance --access public
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: release-please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pull-requests: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release-please:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
pull-requests: write
|
|
19
|
+
issues: write
|
|
20
|
+
steps:
|
|
21
|
+
- name: Run release-please
|
|
22
|
+
uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
|
|
23
|
+
with:
|
|
24
|
+
config-file: .release-please-config.json
|
|
25
|
+
manifest-file: .release-please-manifest.json
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: vouch-check-pr
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- reopened
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
check:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
pull-requests: write
|
|
18
|
+
steps:
|
|
19
|
+
- name: Enforce vouch trust gate on PR author
|
|
20
|
+
# require-vouch=true: unvouched users are treated as blocked.
|
|
21
|
+
# auto-close=true: blocked PRs are automatically closed.
|
|
22
|
+
uses: mitchellh/vouch/action/check-pr@0e11a71bba23218a284d3ecca162e75a110fd7e3
|
|
23
|
+
with:
|
|
24
|
+
pr-number: ${{ github.event.pull_request.number }}
|
|
25
|
+
vouched-file: .github/VOUCHED.td
|
|
26
|
+
require-vouch: "true"
|
|
27
|
+
auto-close: "true"
|
|
28
|
+
env:
|
|
29
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: vouch-manage
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types:
|
|
6
|
+
- created
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: vouch-manage-${{ github.repository }}
|
|
10
|
+
cancel-in-progress: false
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
manage:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: write
|
|
20
|
+
issues: write
|
|
21
|
+
pull-requests: read
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v6
|
|
25
|
+
|
|
26
|
+
- name: Apply vouch / denounce / unvouch from maintainer comments
|
|
27
|
+
uses: mitchellh/vouch/action/manage-by-issue@0e11a71bba23218a284d3ecca162e75a110fd7e3
|
|
28
|
+
with:
|
|
29
|
+
repo: ${{ github.repository }}
|
|
30
|
+
issue-id: ${{ github.event.issue.number }}
|
|
31
|
+
comment-id: ${{ github.event.comment.id }}
|
|
32
|
+
vouched-file: .github/VOUCHED.td
|
|
33
|
+
env:
|
|
34
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
const WORKFLOW_VERSION = "startup-intake-v1";
|
|
4
|
+
const STATE_ENTRY = "startup-intake-router-state";
|
|
5
|
+
|
|
6
|
+
type RouterPhase = "idle" | "intent_captured" | "command_proposed";
|
|
7
|
+
|
|
8
|
+
interface RouterState {
|
|
9
|
+
workflowVersion: string;
|
|
10
|
+
phase: RouterPhase;
|
|
11
|
+
firstMessageProcessed: boolean;
|
|
12
|
+
intent?: string;
|
|
13
|
+
command?: string;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function newState(overrides: Partial<RouterState> = {}): RouterState {
|
|
18
|
+
return {
|
|
19
|
+
workflowVersion: WORKFLOW_VERSION,
|
|
20
|
+
phase: "idle",
|
|
21
|
+
firstMessageProcessed: false,
|
|
22
|
+
updatedAt: Date.now(),
|
|
23
|
+
...overrides,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function normalizeInline(value: string, maxLen = 1200): string {
|
|
28
|
+
const compact = value.replace(/\s+/g, " ").trim();
|
|
29
|
+
if (compact.length <= maxLen) return compact;
|
|
30
|
+
return compact.slice(0, maxLen - 1) + "…";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function quoteArg(value: string): string {
|
|
34
|
+
return JSON.stringify(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function formatCommand(name: string, args: string[]): string {
|
|
38
|
+
return `/${name} ${args.map((arg) => quoteArg(arg)).join(" ")}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function startupIntakeRouter(pi: ExtensionAPI) {
|
|
42
|
+
let state = newState();
|
|
43
|
+
|
|
44
|
+
const persist = () => {
|
|
45
|
+
state.updatedAt = Date.now();
|
|
46
|
+
pi.appendEntry(STATE_ENTRY, state);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const setState = (patch: Partial<RouterState>, save = true) => {
|
|
50
|
+
state = { ...state, ...patch, workflowVersion: WORKFLOW_VERSION };
|
|
51
|
+
if (save) persist();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const restore = (ctx: any) => {
|
|
55
|
+
const branch = ctx.sessionManager.getBranch();
|
|
56
|
+
let restored: RouterState | undefined;
|
|
57
|
+
|
|
58
|
+
for (const entry of branch) {
|
|
59
|
+
if (entry.type === "custom" && entry.customType === STATE_ENTRY && entry.data && typeof entry.data === "object") {
|
|
60
|
+
restored = entry.data as RouterState;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
state = restored ? { ...newState(), ...restored, workflowVersion: WORKFLOW_VERSION } : newState();
|
|
65
|
+
setState({
|
|
66
|
+
firstMessageProcessed: false,
|
|
67
|
+
phase: "idle",
|
|
68
|
+
intent: undefined,
|
|
69
|
+
command: undefined,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const prefill = (ctx: any, command: string, notice: string) => {
|
|
74
|
+
if (!ctx.hasUI) return;
|
|
75
|
+
ctx.ui.setEditorText(command);
|
|
76
|
+
ctx.ui.notify(notice, "info");
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
80
|
+
restore(ctx);
|
|
81
|
+
if (ctx.hasUI) {
|
|
82
|
+
ctx.ui.setStatus("startup-intake", "ready (first-message intake)");
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
pi.on("session_switch", async (_event, ctx) => {
|
|
87
|
+
restore(ctx);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
pi.on("input", async (event, ctx) => {
|
|
91
|
+
if (event.source === "extension") return { action: "continue" as const };
|
|
92
|
+
if (!ctx.hasUI) return { action: "continue" as const };
|
|
93
|
+
if (state.firstMessageProcessed) return { action: "continue" as const };
|
|
94
|
+
|
|
95
|
+
const text = event.text.trim();
|
|
96
|
+
if (!text) return { action: "continue" as const };
|
|
97
|
+
|
|
98
|
+
if (text.startsWith("/")) {
|
|
99
|
+
// Utility commands should not consume first-message intake.
|
|
100
|
+
return { action: "continue" as const };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setState({ firstMessageProcessed: true, phase: "intent_captured" });
|
|
104
|
+
|
|
105
|
+
const intent = normalizeInline(text, 1200);
|
|
106
|
+
const command = formatCommand("init-project-docs", [intent]);
|
|
107
|
+
|
|
108
|
+
setState({
|
|
109
|
+
intent,
|
|
110
|
+
command,
|
|
111
|
+
phase: "command_proposed",
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
prefill(
|
|
115
|
+
ctx,
|
|
116
|
+
command,
|
|
117
|
+
"Startup intent captured. Review/edit and run the command to launch interview-first project doc setup.",
|
|
118
|
+
);
|
|
119
|
+
ctx.ui.setStatus("startup-intake", "init-project-docs command ready");
|
|
120
|
+
|
|
121
|
+
return { action: "handled" as const };
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
pi.registerCommand("startup-intake-router-status", {
|
|
125
|
+
description: "Show startup intake router state",
|
|
126
|
+
handler: async (_args, ctx) => {
|
|
127
|
+
if (!ctx.hasUI) return;
|
|
128
|
+
|
|
129
|
+
const summary = [
|
|
130
|
+
`phase: ${state.phase}`,
|
|
131
|
+
`first_message_processed: ${state.firstMessageProcessed ? "yes" : "no"}`,
|
|
132
|
+
`intent: ${state.intent ?? "<none>"}`,
|
|
133
|
+
`command: ${state.command ?? "<none>"}`,
|
|
134
|
+
`updated_at: ${new Date(state.updatedAt).toISOString()}`,
|
|
135
|
+
];
|
|
136
|
+
ctx.ui.notify(summary.join(" | "), "info");
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
pi.registerCommand("startup-intake-router-reset", {
|
|
141
|
+
description: "Reset startup intake router state for this session",
|
|
142
|
+
handler: async (_args, ctx) => {
|
|
143
|
+
state = newState();
|
|
144
|
+
persist();
|
|
145
|
+
if (ctx.hasUI) {
|
|
146
|
+
ctx.ui.setStatus("startup-intake", "ready (reset)");
|
|
147
|
+
ctx.ui.notify("Startup intake router reset. Next non-command message will propose /init-project-docs.", "info");
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run interview-first initialization for organization and project docs
|
|
3
|
+
system4d:
|
|
4
|
+
container: "Project-local prompt template for startup interview flow."
|
|
5
|
+
compass: "Route startup intent into interview-driven document setup."
|
|
6
|
+
engine: "Intent -> interview -> synthesize -> update docs -> verify."
|
|
7
|
+
fog: "If interview data is incomplete, docs may remain ambiguous."
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
Initialize organization and project docs from interactive intake.
|
|
11
|
+
|
|
12
|
+
Startup intent (if provided): $@
|
|
13
|
+
|
|
14
|
+
Steps:
|
|
15
|
+
1. Read `docs/org/project-docs-intake.questions.json`.
|
|
16
|
+
2. If startup intent is non-empty, create `docs/org/project-docs-intake.runtime.questions.json` with one prepended question:
|
|
17
|
+
- `id`: `startup_intent_confirmation`
|
|
18
|
+
- `type`: `text`
|
|
19
|
+
- `question`: `Startup intent captured: <startup intent>. Confirm or refine this intent before continuing.`
|
|
20
|
+
3. Run the `interview` tool:
|
|
21
|
+
- `questions`: runtime file from step 2 if created, otherwise `docs/org/project-docs-intake.questions.json`
|
|
22
|
+
- `timeout`: `900`
|
|
23
|
+
4. Use interview responses to update these files:
|
|
24
|
+
- `docs/org/operating_model.md`
|
|
25
|
+
- `docs/project/foundation.md`
|
|
26
|
+
- `docs/project/vision.md`
|
|
27
|
+
- `docs/project/strategic_goals.md`
|
|
28
|
+
- `docs/project/tactical_goals.md`
|
|
29
|
+
5. Keep wording fully in English.
|
|
30
|
+
6. Keep **organization purpose** separate from **project purpose**.
|
|
31
|
+
7. Keep output compact.
|
|
32
|
+
8. Run `bash ./scripts/validate-structure.sh`.
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Agent operating guardrails for this repository."
|
|
3
|
+
read_when:
|
|
4
|
+
- "Before an agent edits code or docs in this repository."
|
|
5
|
+
system4d:
|
|
6
|
+
container: "Local repo rules for coding agents."
|
|
7
|
+
compass: "Small diffs, clear validation, no silent assumptions."
|
|
8
|
+
engine: "Read docs -> implement -> validate -> summarize."
|
|
9
|
+
fog: "Task ambiguity resolved by asking concise clarifying questions."
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# AGENTS.md
|
|
13
|
+
|
|
14
|
+
## Defaults
|
|
15
|
+
|
|
16
|
+
- Keep changes reviewable and scoped.
|
|
17
|
+
- Prefer `read` before edits.
|
|
18
|
+
- Prefer markdown links like `[text](path)`.
|
|
19
|
+
- Avoid destructive git/file ops unless explicitly requested.
|
|
20
|
+
|
|
21
|
+
## Docs workflow
|
|
22
|
+
|
|
23
|
+
- Run `npm run docs:list` at task start to surface docs and `read_when` hints.
|
|
24
|
+
- Use `npm run docs:list:workspace` for workspace/monorepo scans.
|
|
25
|
+
- If your docs-list script is not at `~/ai-society/core/agent-scripts/scripts/docs-list.mjs`, set `DOCS_LIST_SCRIPT`.
|
|
26
|
+
|
|
27
|
+
## Validation
|
|
28
|
+
|
|
29
|
+
- Run `npm run check` after structural/documentation changes.
|
|
30
|
+
|
|
31
|
+
## Copier policy
|
|
32
|
+
|
|
33
|
+
- Keep `.copier-answers.yml` tracked.
|
|
34
|
+
- Do not manually edit `.copier-answers.yml`.
|
|
35
|
+
- Run update/recopy from a clean destination repo (commit or stash pending changes first).
|
|
36
|
+
- Use `copier update --trust` when `.copier-answers.yml` includes `_commit` and update is supported.
|
|
37
|
+
- In non-interactive shells/CI, append `--defaults` to update/recopy.
|
|
38
|
+
- Use `copier recopy --trust` when update is unavailable (for example local non-VCS source) or cannot reconcile cleanly.
|
|
39
|
+
- After recopy, re-apply local deltas intentionally and run `npm run check`.
|