devflow-kit 2.4.0 → 3.0.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/CHANGELOG.md +229 -0
- package/README.md +111 -18
- package/dist/agents/git.md +822 -0
- package/dist/cli/commands/agents.js +6 -1
- package/dist/cli/commands/ambient.js +160 -145
- package/dist/cli/commands/attribution-prompts.js +1 -1
- package/dist/cli/commands/capture.js +29 -55
- package/dist/cli/commands/compliance-prompts.js +1 -1
- package/dist/cli/commands/compliance.js +48 -55
- package/dist/cli/commands/context.js +17 -32
- package/dist/cli/commands/debug.js +65 -26
- package/dist/cli/commands/flags.js +3 -3
- package/dist/cli/commands/hud.js +34 -10
- package/dist/cli/commands/init-seed.js +61 -27
- package/dist/cli/commands/init.js +649 -240
- package/dist/cli/commands/install-report.js +200 -0
- package/dist/cli/commands/knowledge/index.js +2 -2
- package/dist/cli/commands/knowledge/toggle.js +35 -37
- package/dist/cli/commands/learning.js +79 -57
- package/dist/cli/commands/legacy-hooks.js +11 -14
- package/dist/cli/commands/memory.js +134 -135
- package/dist/cli/commands/prompt-io.js +4 -4
- package/dist/cli/commands/proxy.js +23 -41
- package/dist/cli/commands/security.js +81 -29
- package/dist/cli/commands/skills.js +71 -7
- package/dist/cli/commands/tracker-prompts.js +145 -0
- package/dist/cli/commands/tracker.js +277 -0
- package/dist/cli/commands/uninstall.js +520 -169
- package/dist/cli.js +2 -0
- package/dist/commands/bug-analysis.md +58 -14
- package/dist/commands/code-review.md +110 -32
- package/dist/commands/debug.md +55 -11
- package/dist/commands/dynamic-build.md +344 -73
- package/dist/commands/dynamic-plan.md +77 -27
- package/dist/commands/dynamic-profile.md +25 -11
- package/dist/commands/dynamic-tickets.md +76 -15
- package/dist/commands/explore.md +37 -7
- package/dist/commands/implement.md +314 -62
- package/dist/commands/plan.md +146 -32
- package/dist/commands/release.md +64 -17
- package/dist/commands/research.md +34 -8
- package/dist/commands/resolve.md +196 -68
- package/dist/commands/self-review.md +45 -9
- package/dist/core/agent-models.js +55 -12
- package/dist/core/assets.js +58 -2
- package/dist/core/compliance-compose.js +27 -27
- package/dist/core/evidence-policy.js +363 -0
- package/dist/core/feature-config.js +200 -65
- package/dist/core/feature-switch.js +112 -0
- package/dist/core/flags.js +34 -6
- package/dist/core/fs-atomic.js +27 -0
- package/dist/core/hook-log-dirs.js +104 -0
- package/dist/core/learning-tuning-config.js +5 -3
- package/dist/core/ledger-root.js +102 -0
- package/dist/core/manifest.js +38 -10
- package/dist/core/mds-variants.js +798 -0
- package/dist/core/migrations.js +49 -23
- package/dist/core/model-discovery.js +12 -1
- package/dist/core/plugins.js +361 -12
- package/dist/core/project-paths.js +1 -18
- package/dist/core/proxy-log.js +8 -6
- package/dist/core/proxy-state.js +11 -8
- package/dist/core/reference-sweep.js +136 -0
- package/dist/core/same-location.js +25 -0
- package/dist/core/tracker.js +494 -0
- package/dist/hud/components/config-counts.js +15 -4
- package/dist/hud/components/learning-counts.js +14 -0
- package/dist/hud/config.js +2 -1
- package/dist/hud/cost-history.js +2 -4
- package/dist/hud/git.js +52 -7
- package/dist/hud/index.js +7 -9
- package/dist/skills/git/references/decision-markers.md +19 -0
- package/dist/skills/git/references/learn-conventions.md +56 -0
- package/dist/skills/git/references/pr/check-ci-status.md +14 -0
- package/dist/skills/git/references/pr/check-merge-readiness.md +28 -0
- package/dist/skills/git/references/pr/ensure-pr-ready.md +24 -0
- package/dist/skills/git/references/pr/fetch-review-threads.md +22 -0
- package/dist/skills/git/references/pr/post-resolution-summary.md +40 -0
- package/dist/skills/git/references/pr/post-review-summary.md +42 -0
- package/dist/skills/git/references/pr/resolve-review-threads.md +35 -0
- package/dist/skills/git/references/pr/update-pr-evidence.md +14 -0
- package/dist/skills/git/references/pr/validate-branch.md +18 -0
- package/dist/skills/git/references/publication-gate.md +13 -0
- package/dist/skills/git/references/tracker/_mcp.md +153 -0
- package/dist/skills/git/references/tracker/github/associate-release.md +18 -0
- package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +40 -0
- package/dist/skills/git/references/tracker/github/create-release.md +11 -0
- package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +16 -0
- package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +69 -0
- package/dist/skills/git/references/tracker/github/fetch-issue.md +32 -0
- package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +17 -0
- package/dist/skills/git/references/tracker/github/gather-release-evidence.md +19 -0
- package/dist/skills/git/references/tracker/github/manage-debt.md +101 -0
- package/dist/skills/git/references/tracker/github/post-wave-report.md +28 -0
- package/dist/skills/git/references/tracker/github/setup-task.md +26 -0
- package/dist/skills/git/references/tracker/jira/associate-release.md +18 -0
- package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +49 -0
- package/dist/skills/git/references/tracker/jira/create-release.md +17 -0
- package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +22 -0
- package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +53 -0
- package/dist/skills/git/references/tracker/jira/fetch-issue.md +14 -0
- package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +15 -0
- package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +18 -0
- package/dist/skills/git/references/tracker/jira/manage-debt.md +37 -0
- package/dist/skills/git/references/tracker/jira/post-wave-report.md +33 -0
- package/dist/skills/git/references/tracker/jira/setup-task.md +31 -0
- package/dist/skills/git/references/tracker/linear/associate-release.md +18 -0
- package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +53 -0
- package/dist/skills/git/references/tracker/linear/create-release.md +17 -0
- package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +22 -0
- package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +53 -0
- package/dist/skills/git/references/tracker/linear/fetch-issue.md +14 -0
- package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +15 -0
- package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +18 -0
- package/dist/skills/git/references/tracker/linear/manage-debt.md +37 -0
- package/dist/skills/git/references/tracker/linear/post-wave-report.md +33 -0
- package/dist/skills/git/references/tracker/linear/setup-task.md +32 -0
- package/dist/skills/git/references/trust-rule.md +7 -0
- package/dist/targets/claude-code/claude-paths.js +59 -57
- package/dist/targets/claude-code/compliance-install.js +49 -65
- package/dist/targets/claude-code/hooks.js +108 -3
- package/dist/targets/claude-code/installer.js +1187 -32
- package/dist/targets/claude-code/legacy.js +5 -0
- package/dist/targets/claude-code/post-install.js +366 -151
- package/dist/targets/claude-code/tracker-install.js +134 -0
- package/package.json +8 -6
- package/src/assets/agents/code.md +45 -6
- package/src/assets/agents/design.md +2 -1
- package/src/assets/agents/git.mds +825 -0
- package/src/assets/agents/knowledge.md +3 -3
- package/src/assets/agents/learning.md +11 -0
- package/src/assets/agents/review.md +3 -1
- package/src/assets/agents/synthesize.md +1 -1
- package/src/assets/agents/test.md +16 -5
- package/src/assets/agents/tracker.md +474 -0
- package/src/assets/agents/validate.md +7 -5
- package/src/assets/commands/_partials/_compliance.mds +19 -1
- package/src/assets/commands/_partials/_decisions.mds +15 -3
- package/src/assets/commands/_partials/_docs_root.mds +35 -0
- package/src/assets/commands/_partials/_engine.mds +13 -11
- package/src/assets/commands/_partials/_evidence_policy.mds +30 -0
- package/src/assets/commands/_partials/_factory.mds +1 -1
- package/src/assets/commands/_partials/_knowledge.mds +27 -9
- package/src/assets/commands/_partials/_plan_contract.mds +22 -7
- package/src/assets/commands/_partials/_preamble.mds +2 -2
- package/src/assets/commands/_partials/_publication.mds +8 -2
- package/src/assets/commands/_partials/_settings.mds +28 -0
- package/src/assets/commands/_partials/_ticket_template.mds +3 -2
- package/src/assets/commands/_partials/_tracker.mds +18 -0
- package/src/assets/commands/_partials/_wave.mds +16 -10
- package/src/assets/commands/bug-analysis.mds +31 -19
- package/src/assets/commands/code-review.mds +67 -41
- package/src/assets/commands/debug.mds +13 -7
- package/src/assets/commands/dynamic-build.mds +274 -66
- package/src/assets/commands/dynamic-plan.mds +50 -23
- package/src/assets/commands/dynamic-profile.mds +24 -11
- package/src/assets/commands/dynamic-tickets.mds +63 -16
- package/src/assets/commands/explore.mds +4 -5
- package/src/assets/commands/implement.mds +234 -67
- package/src/assets/commands/plan.mds +91 -33
- package/src/assets/commands/release.md +64 -17
- package/src/assets/commands/research.mds +11 -9
- package/src/assets/commands/resolve.mds +150 -78
- package/src/assets/commands/self-review.mds +24 -25
- package/src/assets/mds/git/_pr.mds +331 -0
- package/src/assets/mds/git/_references.mds +135 -0
- package/src/assets/mds/tracker/_common.mds +156 -0
- package/src/assets/mds/tracker/_github.mds +472 -0
- package/src/assets/mds/tracker/_jira.mds +407 -0
- package/src/assets/mds/tracker/_linear.mds +449 -0
- package/src/assets/mds/tracker/_mcp.mds +305 -0
- package/src/assets/scripts/hooks/assets/orchestrator-charter.md +5 -8
- package/src/assets/scripts/hooks/background-memory-update +40 -19
- package/src/assets/scripts/hooks/capture-prompt +18 -8
- package/src/assets/scripts/hooks/capture-question +18 -8
- package/src/assets/scripts/hooks/capture-turn +27 -13
- package/src/assets/scripts/hooks/debug-trace +11 -6
- package/src/assets/scripts/hooks/ensure-devflow-init +33 -6
- package/src/assets/scripts/hooks/ensure-proxy +9 -8
- package/src/assets/scripts/hooks/ensure-root-gitignore +236 -60
- package/src/assets/scripts/hooks/git-marker +48 -0
- package/src/assets/scripts/hooks/hook-log-init +3 -1
- package/src/assets/scripts/hooks/json-helper.cjs +228 -5
- package/src/assets/scripts/hooks/lib/project-paths.cjs +1 -20
- package/src/assets/scripts/hooks/log-paths +80 -0
- package/src/assets/scripts/hooks/memory-worker +22 -13
- package/src/assets/scripts/hooks/pre-compact-memory +44 -15
- package/src/assets/scripts/hooks/preamble +1 -4
- package/src/assets/scripts/hooks/queue-append +146 -28
- package/src/assets/scripts/hooks/resolve-project-root +101 -7
- package/src/assets/scripts/hooks/session-start-context +534 -20
- package/src/assets/scripts/hooks/session-start-memory +38 -15
- package/src/assets/scripts/lib/project-config.cjs +633 -0
- package/src/assets/scripts/pr-evidence.cjs +1961 -0
- package/src/assets/scripts/redact-secrets.cjs +490 -62
- package/src/assets/scripts/release-trace.cjs +1143 -0
- package/src/assets/scripts/resolve-evidence-policy.cjs +1145 -0
- package/src/assets/scripts/resolve-settings.cjs +1054 -0
- package/src/assets/scripts/verify-evidence.cjs +1822 -0
- package/src/assets/skills/compliance/SKILL.md +4 -2
- package/src/assets/skills/docs-framework/SKILL.md +11 -10
- package/src/assets/skills/docs-framework/references/patterns.md +10 -17
- package/src/assets/skills/gap-analysis/SKILL.md +2 -2
- package/src/assets/skills/git/SKILL.md +8 -78
- package/src/assets/skills/git/references/github-api.md +179 -141
- package/src/assets/skills/git/references/patterns.md +11 -6
- package/src/assets/skills/review-methodology/SKILL.md +1 -1
- package/src/assets/skills/review-methodology/references/patterns.md +6 -61
- package/src/assets/skills/review-methodology/references/violations.md +14 -22
- package/src/assets/skills/worktree-support/SKILL.md +1 -1
- package/src/assets/skills/worktree-support/references/roots.md +29 -0
- package/src/targets/claude-code/templates/managed-settings.json +25 -9
- package/src/assets/agents/git.md +0 -938
package/dist/core/migrations.js
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { promises as fs } from 'fs';
|
|
12
12
|
import * as path from 'path';
|
|
13
|
-
import * as os from 'os';
|
|
14
13
|
import { writeFileAtomicExclusive } from './fs-atomic.js';
|
|
15
14
|
import { getMemoryDir } from './project-paths.js';
|
|
16
15
|
import { LEGACY_AGENT_KEYS, canonicaliseAgentKeys, parseAgentMappingEnvelope } from './agent-models.js';
|
|
16
|
+
import { migrateLegacyTrackerConventions } from './tracker.js';
|
|
17
17
|
/**
|
|
18
18
|
* D31: Registry pattern over scattered `if (!applied.includes(...))` conditionals.
|
|
19
19
|
*
|
|
@@ -94,23 +94,48 @@ export const MIGRATIONS = [
|
|
|
94
94
|
return { infos, warnings };
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
|
+
{
|
|
98
|
+
id: 'tracker-conventions-per-provider-v1',
|
|
99
|
+
description: 'Move ~/.devflow/tracker.md to ~/.devflow/tracker/{provider}.md, the provider its frontmatter names',
|
|
100
|
+
scope: 'global',
|
|
101
|
+
// D-TRACKER-PER-PROVIDER-CONVENTIONS: conventions became per provider, so the
|
|
102
|
+
// single machine-wide file moves to the file of the provider it was learned
|
|
103
|
+
// for. The move and every refusal to move are migrateLegacyTrackerConventions'
|
|
104
|
+
// (src/core/tracker.ts); this entry maps its outcome onto the runner's
|
|
105
|
+
// contract. A file it leaves in place is REPORTED, once, and the migration is
|
|
106
|
+
// marked applied — the file is user content and nothing a re-run could do
|
|
107
|
+
// differently. An I/O failure THROWS instead: a throwing migration is not
|
|
108
|
+
// marked applied, so the runner retries it on the next `devflow init` rather
|
|
109
|
+
// than recording a move that never happened (the retry-forever path the
|
|
110
|
+
// KNOWN ISSUE above describes is bounded here by what can fail — a rename and
|
|
111
|
+
// an rm inside ~/.devflow).
|
|
112
|
+
async run(ctx) {
|
|
113
|
+
const outcome = await migrateLegacyTrackerConventions(ctx.devflowDir);
|
|
114
|
+
switch (outcome.kind) {
|
|
115
|
+
case 'none':
|
|
116
|
+
return { infos: [], warnings: [] };
|
|
117
|
+
case 'moved':
|
|
118
|
+
return { infos: [`Moved the ${outcome.provider} tracker conventions to ${outcome.to}`], warnings: [] };
|
|
119
|
+
case 'kept':
|
|
120
|
+
return { infos: [], warnings: [`tracker-conventions-per-provider-v1: ${outcome.reason}`] };
|
|
121
|
+
case 'failed':
|
|
122
|
+
throw new Error(outcome.error);
|
|
123
|
+
default: {
|
|
124
|
+
const _exhaustive = outcome;
|
|
125
|
+
return _exhaustive;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
},
|
|
97
130
|
];
|
|
98
131
|
const MIGRATIONS_FILE = 'migrations.json';
|
|
99
132
|
/**
|
|
100
|
-
* D30: State lives at `~/.devflow/migrations.json`
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* `~/.devflow/manifest.json` while local-scope manifests live at
|
|
105
|
-
* `.devflow/manifest.json` inside the repo. A migration that runs on user-scope
|
|
106
|
-
* init wouldn't be recorded in a local-scope manifest, so the migration would
|
|
107
|
-
* re-run on the next local-scope init.
|
|
108
|
-
* - Migration state is machine-wide: once a global migration runs on a machine it
|
|
109
|
-
* should never re-run regardless of which project or scope triggered devflow init.
|
|
110
|
-
* - `~/.devflow/migrations.json` is always writable (home-dir location), whereas
|
|
111
|
-
* local-scope devflowDir may be inside a read-only checkout.
|
|
133
|
+
* D30: State lives at `~/.devflow/migrations.json` rather than in the install
|
|
134
|
+
* manifest because migration state is machine-wide: once a global migration runs
|
|
135
|
+
* on a machine it should never re-run regardless of which project triggered
|
|
136
|
+
* devflow init.
|
|
112
137
|
*
|
|
113
|
-
* @param devflowDir - absolute path to
|
|
138
|
+
* @param devflowDir - absolute path to the resolved machine root (`~/.devflow`)
|
|
114
139
|
*/
|
|
115
140
|
export async function readAppliedMigrations(devflowDir) {
|
|
116
141
|
const filePath = path.join(devflowDir, MIGRATIONS_FILE);
|
|
@@ -227,7 +252,7 @@ async function runGlobalMigration(migration, ctx) {
|
|
|
227
252
|
* additional projects) can retry the failed projects.
|
|
228
253
|
*
|
|
229
254
|
* D37: runPerProjectMigration is unreachable in production — MIGRATIONS holds
|
|
230
|
-
* only
|
|
255
|
+
* only global migrations. The vacuous-truth
|
|
231
256
|
* analysis is preserved for correctness: if a per-project migration is ever
|
|
232
257
|
* added, an empty discoveredProjects list marks it applied (empty-discovery-marks-applied
|
|
233
258
|
* intended); the applied-set write is skipped only when newlyApplied is empty,
|
|
@@ -267,19 +292,20 @@ async function runPerProjectMigration(migration, ctx, discoveredProjects) {
|
|
|
267
292
|
* Run all unapplied migrations from MIGRATIONS.
|
|
268
293
|
*
|
|
269
294
|
* D32: Always-run-unapplied semantics (no fresh-vs-upgrade branch).
|
|
270
|
-
* MIGRATIONS currently holds
|
|
271
|
-
*
|
|
272
|
-
*
|
|
295
|
+
* MIGRATIONS currently holds only global migrations; on a fresh machine each
|
|
296
|
+
* executes once and the applied set is written to migrations.json. On subsequent
|
|
297
|
+
* runs every ID is already in the applied set and the loop is a no-op.
|
|
273
298
|
*
|
|
274
|
-
* @param ctx - devflowDir
|
|
299
|
+
* @param ctx - devflowDir, the resolved machine root (`~/.devflow`) that also holds
|
|
300
|
+
* migrations.json; memoryDir and projectRoot are filled per-project
|
|
275
301
|
* @param discoveredProjects - absolute paths to discovered Claude-enabled project roots
|
|
276
302
|
* @param registryOverride - override MIGRATIONS for testing (defaults to module-level MIGRATIONS)
|
|
277
303
|
*/
|
|
278
304
|
export async function runMigrations(ctx, discoveredProjects, registryOverride) {
|
|
279
305
|
const registry = registryOverride ?? MIGRATIONS;
|
|
280
|
-
//
|
|
281
|
-
|
|
282
|
-
const appliedArray = await readAppliedMigrations(
|
|
306
|
+
// D-ONE-HOME: state lives in the caller's resolved machine root, never a
|
|
307
|
+
// second, independently derived home path (D30: machine-wide state).
|
|
308
|
+
const appliedArray = await readAppliedMigrations(ctx.devflowDir);
|
|
283
309
|
// Convert to Set once for O(1) lookups throughout the loop (issue #9)
|
|
284
310
|
const applied = new Set(appliedArray);
|
|
285
311
|
const newlyApplied = [];
|
|
@@ -323,7 +349,7 @@ export async function runMigrations(ctx, discoveredProjects, registryOverride) {
|
|
|
323
349
|
}
|
|
324
350
|
// Write state once at end, accumulating all newly applied IDs (issue #5 — O(N²) → O(1))
|
|
325
351
|
if (newlyApplied.length > 0) {
|
|
326
|
-
await writeAppliedMigrations(
|
|
352
|
+
await writeAppliedMigrations(ctx.devflowDir, [...appliedArray, ...newlyApplied]);
|
|
327
353
|
}
|
|
328
354
|
return { newlyApplied, failures, infos, warnings };
|
|
329
355
|
}
|
|
@@ -552,7 +552,18 @@ async function _discoverInternal(cacheDir, logPath, deps) {
|
|
|
552
552
|
// completes during the spawn's SPAWN_TIMEOUT_MS window).
|
|
553
553
|
const staleRawP = findStaleFallback(cacheDir, currentKey);
|
|
554
554
|
// --- Live spawn ---
|
|
555
|
-
|
|
555
|
+
// @D-EFR-6 Discovery reads the runtime's built-in registry, never a user config.
|
|
556
|
+
// Since 0.5.0 every implicit config load merges the runtime's user-level file
|
|
557
|
+
// ($XDG_CONFIG_HOME/subswitch/config.json, else ~/.config/subswitch/config.json)
|
|
558
|
+
// under the cwd project file. Devflow's relay never sees that file — it is always
|
|
559
|
+
// started with an explicit SUBSWITCH_CONFIG, which bypasses the merge — so a user
|
|
560
|
+
// alias leaking into discovery would be offered in the picker yet never routed,
|
|
561
|
+
// and a malformed file would fail every live discovery. The cache key also
|
|
562
|
+
// assumes the catalog depends on the runtime version alone. Pointing
|
|
563
|
+
// XDG_CONFIG_HOME at devflow's own cache directory, which never holds a
|
|
564
|
+
// `subswitch/config.json`, makes the lookup a clean ENOENT. SUBSWITCH_CONFIG
|
|
565
|
+
// stays unset (T2): an explicit path that is missing is a hard error.
|
|
566
|
+
const env = { ...scrubChildEnv(), NO_COLOR: '1', XDG_CONFIG_HOME: cacheDir };
|
|
556
567
|
const spawnFn = deps?.spawnAndCollect ?? buildRealSpawnAndCollect(logPath);
|
|
557
568
|
let spawnResult;
|
|
558
569
|
try {
|