@coralai/sps-cli 0.56.2 → 0.56.3
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/dist/console/routes/chat.d.ts +8 -0
- package/dist/console/routes/chat.d.ts.map +1 -1
- package/dist/console/routes/chat.js +157 -30
- package/dist/console/routes/chat.js.map +1 -1
- package/dist/main.js +0 -0
- package/dist/services/ChatService.d.ts +10 -0
- package/dist/services/ChatService.d.ts.map +1 -1
- package/dist/services/ChatService.js +9 -1
- package/dist/services/ChatService.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/wikiCommand.d.ts +0 -77
- package/dist/commands/wikiCommand.d.ts.map +0 -1
- package/dist/commands/wikiCommand.js +0 -489
- package/dist/commands/wikiCommand.js.map +0 -1
- package/dist/core/skillStore.d.ts +0 -55
- package/dist/core/skillStore.d.ts.map +0 -1
- package/dist/core/skillStore.js +0 -224
- package/dist/core/skillStore.js.map +0 -1
- package/dist/core/wiki/frontmatter.d.ts +0 -55
- package/dist/core/wiki/frontmatter.d.ts.map +0 -1
- package/dist/core/wiki/frontmatter.js +0 -109
- package/dist/core/wiki/frontmatter.js.map +0 -1
- package/dist/core/wiki/hot.d.ts +0 -27
- package/dist/core/wiki/hot.d.ts.map +0 -1
- package/dist/core/wiki/hot.js +0 -124
- package/dist/core/wiki/hot.js.map +0 -1
- package/dist/core/wiki/index-builder.d.ts +0 -37
- package/dist/core/wiki/index-builder.d.ts.map +0 -1
- package/dist/core/wiki/index-builder.js +0 -130
- package/dist/core/wiki/index-builder.js.map +0 -1
- package/dist/core/wiki/linter.d.ts +0 -76
- package/dist/core/wiki/linter.d.ts.map +0 -1
- package/dist/core/wiki/linter.js +0 -280
- package/dist/core/wiki/linter.js.map +0 -1
- package/dist/core/wiki/log.d.ts +0 -24
- package/dist/core/wiki/log.d.ts.map +0 -1
- package/dist/core/wiki/log.js +0 -107
- package/dist/core/wiki/log.js.map +0 -1
- package/dist/core/wiki/manifest.d.ts +0 -59
- package/dist/core/wiki/manifest.d.ts.map +0 -1
- package/dist/core/wiki/manifest.js +0 -180
- package/dist/core/wiki/manifest.js.map +0 -1
- package/dist/core/wiki/page.d.ts +0 -72
- package/dist/core/wiki/page.d.ts.map +0 -1
- package/dist/core/wiki/page.js +0 -221
- package/dist/core/wiki/page.js.map +0 -1
- package/dist/core/wiki/reader.d.ts +0 -102
- package/dist/core/wiki/reader.d.ts.map +0 -1
- package/dist/core/wiki/reader.js +0 -225
- package/dist/core/wiki/reader.js.map +0 -1
- package/dist/core/wiki/scaffold.d.ts +0 -42
- package/dist/core/wiki/scaffold.d.ts.map +0 -1
- package/dist/core/wiki/scaffold.js +0 -223
- package/dist/core/wiki/scaffold.js.map +0 -1
- package/dist/core/wiki/searcher.d.ts +0 -73
- package/dist/core/wiki/searcher.d.ts.map +0 -1
- package/dist/core/wiki/searcher.js +0 -216
- package/dist/core/wiki/searcher.js.map +0 -1
- package/dist/core/wiki/sources.d.ts +0 -84
- package/dist/core/wiki/sources.d.ts.map +0 -1
- package/dist/core/wiki/sources.js +0 -261
- package/dist/core/wiki/sources.js.map +0 -1
- package/dist/core/wiki/types.d.ts +0 -441
- package/dist/core/wiki/types.d.ts.map +0 -1
- package/dist/core/wiki/types.js +0 -109
- package/dist/core/wiki/types.js.map +0 -1
- package/dist/shared/wikiPaths.d.ts +0 -38
- package/dist/shared/wikiPaths.d.ts.map +0 -1
- package/dist/shared/wikiPaths.js +0 -89
- package/dist/shared/wikiPaths.js.map +0 -1
- package/project-template/.claude/CLAUDE.md +0 -66
- package/project-template/.claude/hooks/start.sh +0 -44
- package/project-template/.claude/hooks/stop.sh +0 -54
- package/project-template/.claude/rules/.gitkeep +0 -0
- package/project-template/.claude/settings.json +0 -32
- package/project-template/.claude/settings.local.json.template +0 -3
- package/project-template/.claude/skills/.gitkeep +0 -0
- package/project-template/README.md +0 -10
- package/project-template/batch_scheduler.sh +0 -8
- package/project-template/conf.template +0 -61
- package/project-template/deploy.sh +0 -3
- package/project-template/pm_meta/.gitkeep +0 -0
package/dist/shared/wikiPaths.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module shared/wikiPaths
|
|
3
|
-
* @description Wiki vault 文件系统路径单一来源
|
|
4
|
-
*
|
|
5
|
-
* @layer shared
|
|
6
|
-
*
|
|
7
|
-
* Wiki 实际位置:`<repo>/wiki/`(per-project,进 git 团队共享)。
|
|
8
|
-
* 这里所有 helper 都是相对 repo 根目录的纯函数——不依赖 SPS instance state,
|
|
9
|
-
* 不依赖 ProjectContext,方便测试。
|
|
10
|
-
*
|
|
11
|
-
* 命名规范:见 doc-28 §4 目录结构。
|
|
12
|
-
* - dot-prefix 文件(.hot.md / .log.md / .manifest.json)→ gitignored 的 per-instance 飘移
|
|
13
|
-
* - dot-prefix 目录(.raw/)→ Obsidian 视图隐藏,但进 git 共享
|
|
14
|
-
* - underscore-prefix(_attachments)→ Obsidian 约定的"非 wiki 内容"
|
|
15
|
-
*/
|
|
16
|
-
import { resolve } from 'node:path';
|
|
17
|
-
/** `<repo>/wiki/` —— Wiki vault 根目录。Obsidian Open folder 指向这里。 */
|
|
18
|
-
export function wikiDir(repoDir) {
|
|
19
|
-
return resolve(repoDir, 'wiki');
|
|
20
|
-
}
|
|
21
|
-
/** `<repo>/wiki/WIKI.md` —— schema + sources 配置 */
|
|
22
|
-
export function wikiMetaFile(repoDir) {
|
|
23
|
-
return resolve(wikiDir(repoDir), 'WIKI.md');
|
|
24
|
-
}
|
|
25
|
-
/** `<repo>/wiki/index.md` —— 全部 page 的 catalog */
|
|
26
|
-
export function wikiIndexFile(repoDir) {
|
|
27
|
-
return resolve(wikiDir(repoDir), 'index.md');
|
|
28
|
-
}
|
|
29
|
-
/** `<repo>/wiki/overview.md` —— 项目执行摘要 */
|
|
30
|
-
export function wikiOverviewFile(repoDir) {
|
|
31
|
-
return resolve(wikiDir(repoDir), 'overview.md');
|
|
32
|
-
}
|
|
33
|
-
/** `<repo>/wiki/.hot.md` —— ~500 字最近上下文(gitignored) */
|
|
34
|
-
export function wikiHotFile(repoDir) {
|
|
35
|
-
return resolve(wikiDir(repoDir), '.hot.md');
|
|
36
|
-
}
|
|
37
|
-
/** `<repo>/wiki/.log.md` —— 操作时间序列(gitignored) */
|
|
38
|
-
export function wikiLogFile(repoDir) {
|
|
39
|
-
return resolve(wikiDir(repoDir), '.log.md');
|
|
40
|
-
}
|
|
41
|
-
/** `<repo>/wiki/.manifest.json` —— 源 hash 跟踪表(gitignored) */
|
|
42
|
-
export function wikiManifestFile(repoDir) {
|
|
43
|
-
return resolve(wikiDir(repoDir), '.manifest.json');
|
|
44
|
-
}
|
|
45
|
-
/** `<repo>/wiki/.raw/` —— 用户外部添加的源材料(committed by default) */
|
|
46
|
-
export function wikiRawDir(repoDir) {
|
|
47
|
-
return resolve(wikiDir(repoDir), '.raw');
|
|
48
|
-
}
|
|
49
|
-
/** `<repo>/wiki/_attachments/` —— 嵌入图片(committed) */
|
|
50
|
-
export function wikiAttachmentsDir(repoDir) {
|
|
51
|
-
return resolve(wikiDir(repoDir), '_attachments');
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* `<repo>/wiki/<type>s/` —— 特定类型 page 目录。
|
|
55
|
-
* 名约定:复数后缀(modules/, concepts/, decisions/, lessons/, sources/)。
|
|
56
|
-
*/
|
|
57
|
-
export function wikiPageDir(repoDir, type) {
|
|
58
|
-
return resolve(wikiDir(repoDir), `${type}s`);
|
|
59
|
-
}
|
|
60
|
-
/** `<repo>/wiki/<type>s/<title>.md` —— 单页文件路径 */
|
|
61
|
-
export function wikiPageFile(repoDir, type, title) {
|
|
62
|
-
return resolve(wikiPageDir(repoDir, type), `${title}.md`);
|
|
63
|
-
}
|
|
64
|
-
/** Page id 格式:`<type>s/<title>`(不含 .md)。用作 frontmatter related / sources 字段 */
|
|
65
|
-
export function wikiPageId(type, title) {
|
|
66
|
-
return `${type}s/${title}`;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 从绝对路径反推 (type, title) —— 用于 listing 时把文件名解析回 page 标识。
|
|
70
|
-
* 只接受 wikiDir 子路径,否则返 null。
|
|
71
|
-
*/
|
|
72
|
-
export function parseWikiPageId(repoDir, filePath) {
|
|
73
|
-
const root = wikiDir(repoDir);
|
|
74
|
-
const PAGE_TYPES = ['module', 'concept', 'decision', 'lesson', 'source'];
|
|
75
|
-
for (const t of PAGE_TYPES) {
|
|
76
|
-
const dir = wikiPageDir(repoDir, t);
|
|
77
|
-
if (filePath.startsWith(dir + '/') && filePath.endsWith('.md')) {
|
|
78
|
-
const rel = filePath.slice(dir.length + 1, -3);
|
|
79
|
-
// 不允许子目录嵌套——title 不含路径分隔符
|
|
80
|
-
if (rel.includes('/'))
|
|
81
|
-
return null;
|
|
82
|
-
return { type: t, title: rel, pageId: wikiPageId(t, rel) };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// 不在已知 type dir 下;可能是 index/overview/hot/log 等顶层文件
|
|
86
|
-
void root;
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=wikiPaths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wikiPaths.js","sourceRoot":"","sources":["../../src/shared/wikiPaths.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# Project Rules (Claude Code Worker)
|
|
2
|
-
|
|
3
|
-
<!--
|
|
4
|
-
This file is auto-generated by `sps project init` / `sps doctor --fix`.
|
|
5
|
-
Edit it to add project-specific rules. SPS will not overwrite it once it exists.
|
|
6
|
-
-->
|
|
7
|
-
|
|
8
|
-
## Scope
|
|
9
|
-
|
|
10
|
-
- Work only in the current project directory.
|
|
11
|
-
- Do NOT read or modify files outside this directory.
|
|
12
|
-
- Do NOT explore `~/.coral/projects/...` or other system paths.
|
|
13
|
-
|
|
14
|
-
## SPS Pipeline Context
|
|
15
|
-
|
|
16
|
-
This project is driven by SPS (Smart Pipeline System). Each card is a task.
|
|
17
|
-
When you are launched as a worker, two env vars identify your stable context:
|
|
18
|
-
|
|
19
|
-
- `$SPS_PROJECT` — project name (stable across card reuse)
|
|
20
|
-
- `$SPS_WORKER_SLOT` — worker slot name (stable across card reuse)
|
|
21
|
-
|
|
22
|
-
Per-card information (card id, stage name, title) is **not** in env. POSIX
|
|
23
|
-
freezes env at spawn, so any per-card value would go stale once the claude
|
|
24
|
-
process is reused for the next card. If you need the current card info,
|
|
25
|
-
read the marker file or use the `sps` CLI:
|
|
26
|
-
|
|
27
|
-
- Marker file: `~/.coral/projects/$SPS_PROJECT/runtime/worker-$SPS_WORKER_SLOT-current.json`
|
|
28
|
-
- CLI: `sps card dashboard $SPS_PROJECT` (or the command your task prompt already passed to you)
|
|
29
|
-
|
|
30
|
-
## Card lifecycle labels (for reference — all managed automatically)
|
|
31
|
-
|
|
32
|
-
Each card moves through these labels during its pipeline run:
|
|
33
|
-
|
|
34
|
-
- `AI-PIPELINE` — added at `sps card add`; the pipeline admission mark
|
|
35
|
-
- `CLAIMED` — added when SPS claims a worker slot for this card
|
|
36
|
-
- `STARTED-<stage>` — added automatically on each prompt submit via the
|
|
37
|
-
**UserPromptSubmit** hook. This is the "ACK signal" that proves Claude
|
|
38
|
-
received the prompt. If this label doesn't appear within
|
|
39
|
-
`WORKER_ACK_TIMEOUT_S` seconds after dispatch, SPS's MonitorEngine flags
|
|
40
|
-
`ACK-TIMEOUT` and StageEngine kills the worker + retries.
|
|
41
|
-
- `COMPLETED-<stage>` — added on turn end via the **Stop hook**. Tells SPS
|
|
42
|
-
to advance the card to the next stage (or Done).
|
|
43
|
-
|
|
44
|
-
You do NOT need to manually update card state, move the card between
|
|
45
|
-
columns, or commit on behalf of the pipeline. The hooks do it all.
|
|
46
|
-
|
|
47
|
-
**Honesty note**: If you declare "done" without actually implementing the
|
|
48
|
-
work, the pipeline will still advance (the Stop hook fires regardless). The
|
|
49
|
-
user relies on your honesty here.
|
|
50
|
-
|
|
51
|
-
## Memory
|
|
52
|
-
|
|
53
|
-
- Claude's **auto memory** is enabled and stored under
|
|
54
|
-
`~/.coral/projects/$SPS_PROJECT/memory/`. You write to `MEMORY.md` there
|
|
55
|
-
to persist knowledge across sessions.
|
|
56
|
-
- Use `sps memory add $SPS_PROJECT --type ...` to write structured SPS memories
|
|
57
|
-
(conventions, decisions, lessons) for the human to curate.
|
|
58
|
-
|
|
59
|
-
## Git (if the project uses git)
|
|
60
|
-
|
|
61
|
-
- Claude handles all git operations itself (commit, push, etc.).
|
|
62
|
-
- SPS does NOT intervene in git workflows or conflict resolution.
|
|
63
|
-
|
|
64
|
-
## Project-specific rules
|
|
65
|
-
|
|
66
|
-
<!-- Add your own conventions, architecture notes, and constraints below. -->
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# SPS Pipeline Worker — UserPromptSubmit hook (v0.42.0+)
|
|
3
|
-
#
|
|
4
|
-
# Triggered synchronously before Claude processes each prompt. Used by SPS
|
|
5
|
-
# to label the card with STARTED-<stage> — this is the "ACK signal" that
|
|
6
|
-
# proves Claude received the prompt. Also injects skill hints based on the
|
|
7
|
-
# card's `skills` field (or legacy skill:* labels).
|
|
8
|
-
#
|
|
9
|
-
# Phase 2 is user-customizable: add audit logging, request rate limiting,
|
|
10
|
-
# prompt enrichment, etc. without touching Phase 1.
|
|
11
|
-
#
|
|
12
|
-
# Env vars (stable across claude process reuse):
|
|
13
|
-
# SPS_PROJECT Project name
|
|
14
|
-
# SPS_WORKER_SLOT Worker slot name
|
|
15
|
-
#
|
|
16
|
-
# Per-card info (card id, stage, title) is NOT in env — POSIX env freezes at
|
|
17
|
-
# spawn. Hook scripts must read the marker file instead. Phase 1 does this
|
|
18
|
-
# automatically via `sps hook user-prompt-submit`.
|
|
19
|
-
|
|
20
|
-
set -e
|
|
21
|
-
|
|
22
|
-
# ─── Phase 1: SPS official action (do NOT remove) ────────────────────
|
|
23
|
-
# Reads marker file → addLabel STARTED-<stage> + emit skill hints.
|
|
24
|
-
sps hook user-prompt-submit
|
|
25
|
-
|
|
26
|
-
# ─── Phase 2: User-customizable actions (edit as needed) ────────────
|
|
27
|
-
|
|
28
|
-
# Example: audit log of every prompt submission.
|
|
29
|
-
# if [ -n "$SPS_PROJECT" ] && [ -n "$SPS_WORKER_SLOT" ]; then
|
|
30
|
-
# echo "$(date): prompt submitted to $SPS_PROJECT/$SPS_WORKER_SLOT" \
|
|
31
|
-
# >> "$CLAUDE_PROJECT_DIR/.sps/user-prompts.log"
|
|
32
|
-
# fi
|
|
33
|
-
|
|
34
|
-
# Example: rate limiting (block if too many prompts in a window).
|
|
35
|
-
# count=$(find "$CLAUDE_PROJECT_DIR/.sps" -name 'last-prompt-*' -mmin -1 | wc -l)
|
|
36
|
-
# if [ "$count" -gt 30 ]; then
|
|
37
|
-
# echo '{"decision":"block","reason":"rate limit exceeded (>30 prompts/min)"}'
|
|
38
|
-
# exit 0
|
|
39
|
-
# fi
|
|
40
|
-
|
|
41
|
-
# Example: prompt-to-Slack mirror for team visibility.
|
|
42
|
-
# curl -sfX POST "$SLACK_WEBHOOK" -d "{\"text\":\"[$SPS_PROJECT] new prompt\"}"
|
|
43
|
-
|
|
44
|
-
exit 0
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# SPS Pipeline Worker — Stop hook
|
|
3
|
-
#
|
|
4
|
-
# Triggered when Claude finishes its current turn. The pipeline depends on
|
|
5
|
-
# Phase 1 to advance card state. Phase 2+ is user-customizable.
|
|
6
|
-
#
|
|
7
|
-
# Env vars (set by SPS worker at spawn time, frozen for the process lifetime):
|
|
8
|
-
# SPS_PROJECT Project name (stable across card reuse)
|
|
9
|
-
# SPS_WORKER_SLOT Worker slot name (stable across card reuse)
|
|
10
|
-
#
|
|
11
|
-
# These two env vars form the index to locate the per-slot marker file:
|
|
12
|
-
# ~/.coral/projects/$SPS_PROJECT/runtime/worker-$SPS_WORKER_SLOT-current.json
|
|
13
|
-
#
|
|
14
|
-
# Per-card info (card id, stage name, card title) is intentionally NOT in env.
|
|
15
|
-
# POSIX freezes env at spawn; when the claude process is reused for the next
|
|
16
|
-
# card, any per-card env would go stale. Always read the marker file (or use
|
|
17
|
-
# `sps` CLI) to get current card information.
|
|
18
|
-
#
|
|
19
|
-
# Claude-native env also available:
|
|
20
|
-
# CLAUDE_PROJECT_DIR, CLAUDE_SESSION_ID
|
|
21
|
-
|
|
22
|
-
set -e
|
|
23
|
-
|
|
24
|
-
# ─── Phase 1: SPS official action (do NOT remove) ────────────────────
|
|
25
|
-
# Mark the card complete so pipeline can advance state.
|
|
26
|
-
# We call mark-complete WITHOUT a seq — the command reads the per-slot
|
|
27
|
-
# current-card marker file (written by the worker manager on each dispatch)
|
|
28
|
-
# to get the authoritative current card. This is the only way to be correct
|
|
29
|
-
# when the same claude process handles multiple cards in sequence.
|
|
30
|
-
if [ -n "$SPS_PROJECT" ] && [ -n "$SPS_WORKER_SLOT" ]; then
|
|
31
|
-
# 绝不让 mark-complete 失败阻塞 stop:Stop hook 非零退出会被 claude 当成"别停、继续",
|
|
32
|
-
# 导致 worker 被无限重戳("Acknowledged." 死循环)。失败仅记 stderr(MonitorEngine 有超时兜底)。
|
|
33
|
-
sps card mark-complete "$SPS_PROJECT" || echo "[stop.sh] mark-complete non-fatal failure — allowing stop" >&2
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# ─── Phase 2: User-customizable actions (edit as needed) ────────────
|
|
37
|
-
|
|
38
|
-
# Example: record the session transcript location for later audit.
|
|
39
|
-
# if [ -n "$CLAUDE_SESSION_ID" ] && [ -n "$SPS_CARD_ID" ]; then
|
|
40
|
-
# echo "$CLAUDE_SESSION_ID" >> "$CLAUDE_PROJECT_DIR/.sps/session-log.txt"
|
|
41
|
-
# fi
|
|
42
|
-
|
|
43
|
-
# Example: third-party knowledge base capture.
|
|
44
|
-
# if command -v your-kb-cli &>/dev/null; then
|
|
45
|
-
# your-kb-cli capture --project "$SPS_PROJECT" --session "$CLAUDE_SESSION_ID"
|
|
46
|
-
# fi
|
|
47
|
-
|
|
48
|
-
# Example: notify on completion.
|
|
49
|
-
# sps notify matrix "[$SPS_PROJECT] seq $SPS_CARD_ID ($SPS_STAGE) done"
|
|
50
|
-
|
|
51
|
-
# Example: post-task CI trigger.
|
|
52
|
-
# curl -sfX POST "$CI_WEBHOOK" -d "{\"project\":\"$SPS_PROJECT\",\"card\":\"$SPS_CARD_ID\"}"
|
|
53
|
-
|
|
54
|
-
exit 0
|
|
File without changes
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
-
"hooks": {
|
|
4
|
-
"Stop": [
|
|
5
|
-
{
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop.sh"
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"UserPromptSubmit": [
|
|
15
|
-
{
|
|
16
|
-
"hooks": [
|
|
17
|
-
{
|
|
18
|
-
"type": "command",
|
|
19
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/start.sh"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
"attribution": {
|
|
26
|
-
"commit": "",
|
|
27
|
-
"pr": ""
|
|
28
|
-
},
|
|
29
|
-
"companyAnnouncements": [
|
|
30
|
-
"🔧 SPS Pipeline Worker — completion is declared via Stop hook \u2192 COMPLETED-<stage> label"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
File without changes
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Project Template
|
|
2
|
-
|
|
3
|
-
This folder is copied into `~/.coral/projects/<project-name>/` for each new pipeline-managed project.
|
|
4
|
-
|
|
5
|
-
Contents:
|
|
6
|
-
- `conf` — project-specific configuration
|
|
7
|
-
- `deploy.sh` — optional project-local deploy entrypoint
|
|
8
|
-
- `batch_scheduler.sh` — project-local Planning → Backlog scheduler
|
|
9
|
-
- `logs/` — runtime logs
|
|
10
|
-
- `pm_meta/` — local PM metadata store (used especially for Plane)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# ── 项目基础信息 ─────────────────────────────────────────────────
|
|
2
|
-
export PROJECT_NAME="__PROJECT_NAME__"
|
|
3
|
-
|
|
4
|
-
# ── 路径配置(可选,不设置则使用默认值)───────────────────────────
|
|
5
|
-
# 业务代码仓库目录(默认: ~/projects/<project>)
|
|
6
|
-
# export PROJECT_DIR="$HOME/projects/__PROJECT_NAME__"
|
|
7
|
-
# Worker worktree 根目录(默认: ~/.coral/worktrees/)
|
|
8
|
-
# export WORKTREE_DIR="$HOME/.coral/worktrees"
|
|
9
|
-
|
|
10
|
-
# ── GitLab(项目特有)──────────────────────────────────────────
|
|
11
|
-
# GITLAB_URL / GITLAB_TOKEN 从全局 ~/.coral/env 继承,此处不重复
|
|
12
|
-
export GITLAB_PROJECT="__GITLAB_PROJECT__"
|
|
13
|
-
# GITLAB_PROJECT_ID 可选 — 留空则通过 GITLAB_PROJECT 路径自动查询
|
|
14
|
-
# export GITLAB_PROJECT_ID=""
|
|
15
|
-
export GITLAB_MERGE_BRANCH="develop"
|
|
16
|
-
|
|
17
|
-
# ── PM Backend ───────────────────────────────────────────────────
|
|
18
|
-
export PM_TOOL="plane"
|
|
19
|
-
|
|
20
|
-
# ── Trello(PM_TOOL=trello 时填写)───────────────────────────────
|
|
21
|
-
# TRELLO_API_KEY / TRELLO_TOKEN 从全局 ~/.coral/env 继承
|
|
22
|
-
# export TRELLO_BOARD_ID=""
|
|
23
|
-
# export TRELLO_LIST_PLANNING=""
|
|
24
|
-
# export TRELLO_LIST_BACKLOG=""
|
|
25
|
-
# export TRELLO_LIST_TODO=""
|
|
26
|
-
# export TRELLO_LIST_INPROGRESS=""
|
|
27
|
-
# export TRELLO_LIST_QA=""
|
|
28
|
-
# export TRELLO_LIST_DONE=""
|
|
29
|
-
# export TRELLO_ACCOUNT=""
|
|
30
|
-
|
|
31
|
-
# ── Plane(PM_TOOL=plane 时填写)────────────────────────────────
|
|
32
|
-
# PLANE_URL / PLANE_API_KEY / PLANE_WORKSPACE_SLUG 从全局 ~/.coral/env 继承
|
|
33
|
-
export PLANE_PROJECT_ID="__PLANE_PROJECT_ID__"
|
|
34
|
-
export PLANE_STATE_PLANNING="__PLANE_STATE_PLANNING__"
|
|
35
|
-
export PLANE_STATE_BACKLOG="__PLANE_STATE_BACKLOG__"
|
|
36
|
-
export PLANE_STATE_TODO="__PLANE_STATE_TODO__"
|
|
37
|
-
export PLANE_STATE_INPROGRESS="__PLANE_STATE_INPROGRESS__"
|
|
38
|
-
export PLANE_STATE_QA="__PLANE_STATE_QA__"
|
|
39
|
-
export PLANE_STATE_DONE="__PLANE_STATE_DONE__"
|
|
40
|
-
|
|
41
|
-
# ── Pipeline ─────────────────────────────────────────────────────
|
|
42
|
-
export PIPELINE_LABEL="AI-PIPELINE"
|
|
43
|
-
export MR_MODE="none"
|
|
44
|
-
|
|
45
|
-
# ── Worker / Agent ───────────────────────────────────────────────
|
|
46
|
-
# claude is the only supported CLI; no selector exposed.
|
|
47
|
-
export MAX_CONCURRENT_WORKERS=3
|
|
48
|
-
# export MAX_ACTIONS_PER_TICK=1
|
|
49
|
-
# export WORKER_RESTART_LIMIT=2
|
|
50
|
-
# export DEFAULT_WORKER_SKILLS="senior"
|
|
51
|
-
|
|
52
|
-
# ── 超时与策略(可选,以下为默认值)──────────────────────────────
|
|
53
|
-
# export INPROGRESS_TIMEOUT_HOURS=8
|
|
54
|
-
# export MONITOR_AUTO_QA=false
|
|
55
|
-
# export CONFLICT_DEFAULT=serial
|
|
56
|
-
# export TICK_LOCK_TIMEOUT_MINUTES=30
|
|
57
|
-
|
|
58
|
-
# ── 通知(项目特有 — 不同项目可发不同房间)──────────────────────
|
|
59
|
-
# MATRIX_HOMESERVER / MATRIX_ACCESS_TOKEN 从全局 ~/.coral/env 继承
|
|
60
|
-
# 如果项目需要发到特定房间,设置 MATRIX_ROOM_ID:
|
|
61
|
-
# export MATRIX_ROOM_ID=""
|
|
File without changes
|