tspl-cli 0.0.0-stage → 0.1.1

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 (75) hide show
  1. package/README.md +127 -2
  2. package/bin/tspl.js +10 -0
  3. package/package.json +41 -4
  4. package/src/active-org.js +49 -0
  5. package/src/analysis/analyzer.js +61 -0
  6. package/src/analysis/extract.js +37 -0
  7. package/src/analysis/file-filter.js +69 -0
  8. package/src/analysis/git-reader.js +108 -0
  9. package/src/analysis/html-parser.js +46 -0
  10. package/src/analysis/js-parser.js +473 -0
  11. package/src/analysis/py-parser.js +66 -0
  12. package/src/analysis/repo-index.js +107 -0
  13. package/src/api-client.js +108 -0
  14. package/src/browser-tests.js +209 -0
  15. package/src/commands/analyze.command.js +81 -0
  16. package/src/commands/auth.command.js +250 -0
  17. package/src/commands/build.command.js +267 -0
  18. package/src/commands/connect.command.js +270 -0
  19. package/src/commands/engines.command.js +136 -0
  20. package/src/commands/find.command.js +107 -0
  21. package/src/commands/init.command.js +79 -0
  22. package/src/commands/link.command.js +65 -0
  23. package/src/commands/mcp.command.js +12 -0
  24. package/src/commands/member.command.js +82 -0
  25. package/src/commands/plan.command.js +161 -0
  26. package/src/commands/project.command.js +191 -0
  27. package/src/commands/setup.command.js +63 -0
  28. package/src/commands/sync.command.js +59 -0
  29. package/src/commands/task.command.js +475 -0
  30. package/src/commands/usage.command.js +105 -0
  31. package/src/config-store.js +255 -0
  32. package/src/connect/claude-skill.md +30 -0
  33. package/src/engines.js +218 -0
  34. package/src/find/graph.js +272 -0
  35. package/src/find/search.js +473 -0
  36. package/src/find/text.js +86 -0
  37. package/src/git-helper.js +102 -0
  38. package/src/index.js +91 -0
  39. package/src/mcp/server.js +708 -0
  40. package/src/project-config.js +197 -0
  41. package/src/project-init.js +447 -0
  42. package/src/providers/github.js +249 -0
  43. package/src/providers/index.js +83 -0
  44. package/src/runtime-check.js +18 -0
  45. package/src/setup.js +180 -0
  46. package/src/shared/approaches.js +44 -0
  47. package/src/shared/constants.js +89 -0
  48. package/src/shared/index.js +8 -0
  49. package/src/shared/workflow-progress.js +67 -0
  50. package/src/shared/workflow.js +381 -0
  51. package/src/stack-detector.js +47 -0
  52. package/src/task/approaches.js +53 -0
  53. package/src/task/branch-choice.js +69 -0
  54. package/src/task/brief.js +115 -0
  55. package/src/task/build.js +549 -0
  56. package/src/task/check.js +415 -0
  57. package/src/task/conventions.js +113 -0
  58. package/src/task/gate.js +88 -0
  59. package/src/task/hooks.js +82 -0
  60. package/src/task/plan-draft.js +43 -0
  61. package/src/task/plan-page.js +123 -0
  62. package/src/task/plan.js +293 -0
  63. package/src/task/planning-context.js +165 -0
  64. package/src/task/refine.js +73 -0
  65. package/src/workflow/agents.js +336 -0
  66. package/src/workflow/checkout-lock.js +92 -0
  67. package/src/workflow/client.js +82 -0
  68. package/src/workflow/controller.js +585 -0
  69. package/src/workflow/evidence.js +276 -0
  70. package/src/workflow/pr-body.js +52 -0
  71. package/src/workflow/process.js +82 -0
  72. package/src/workflow/review.js +128 -0
  73. package/src/workflow/runtime.js +148 -0
  74. package/src/workflow/wait.js +58 -0
  75. package/src/workspace.js +250 -0
package/src/index.js ADDED
@@ -0,0 +1,91 @@
1
+ 'use strict'
2
+
3
+ const { Command } = require('commander')
4
+
5
+ const { version } = require('../package.json')
6
+ const { useFolderOrganization } = require('./active-org')
7
+ const { findProjectConfig } = require('./project-config')
8
+
9
+ const WAITING = {
10
+ draft: 'plan it: tspl <id> (or /tspl <id> in your AI tool)',
11
+ 'plan-review': 'approve the plan: tspl plan approve <id>',
12
+ 'pm-review': 'waits for PM approval',
13
+ 'changes-requested': 'update the plan: /tspl <id>',
14
+ approved: 'build it: tspl <id>',
15
+ building: 'continue: tspl <id>',
16
+ }
17
+
18
+ /** What is going on in this project folder, and the one command for each task. */
19
+ const overview = async cwd => {
20
+ const { request } = require('./api-client')
21
+ const { findProject } = require('./workspace')
22
+ const { project } = await findProject(cwd)
23
+ const tasks = await request('GET', `/api/v1/projects/${project._id}/tasks`)
24
+ const open = tasks.filter(task => task.status !== 'done')
25
+ console.log(`${project.name}: ${open.length} open task${open.length === 1 ? '' : 's'}${tasks.length - open.length ? `, ${tasks.length - open.length} done` : ''}`)
26
+ open.slice(0, 20).forEach(task => {
27
+ const stage = task.workflow && task.workflow.stage ? ` · ${task.workflow.stage}${task.workflow.blocker ? ` (${task.workflow.blocker.reason})` : ''}` : ''
28
+ console.log(` ${task.key.padEnd(18)} ${(task.title || '').slice(0, 50).padEnd(50)} ${task.status}${stage}`)
29
+ console.log(` ${''.padEnd(18)} → ${(WAITING[task.status] || '').replace('<id>', task.key)}`)
30
+ })
31
+ if (!open.length) console.log(' Nothing open. Create a task in the console, or: tspl task new "<what should change>"')
32
+ }
33
+
34
+ const run = async argv => {
35
+ const program = new Command()
36
+ program
37
+ .name('tspl')
38
+ .description('TSPL AI feature-development tool. Run it inside a project folder: `tspl` sets the folder up or shows its tasks; `tspl <task id>` continues a task.')
39
+ .version(version)
40
+ .enablePositionalOptions()
41
+ .argument('[task]', 'a task id (t-…) to continue from wherever it is')
42
+ .option('-y, --yes', 'accept every suggestion without asking')
43
+ .option('--name <name>', 'project name, if a new project is created')
44
+ .option('--confirm-delivery', 'with a task id: confirm pushing and opening draft pull requests')
45
+ .action(async (task, options) => {
46
+ if (task) {
47
+ if (!/^t-[a-z0-9-]+$/i.test(task)) throw new Error(`Unknown command or task id "${task}". See: tspl --help`)
48
+ return require('./commands/task.command').runWorkflow(task, options)
49
+ }
50
+ if (!findProjectConfig(process.cwd())) {
51
+ console.log('This folder is not set up for tspl yet; setting it up now (same as tspl init).\n')
52
+ return require('./commands/init.command').init(undefined, options)
53
+ }
54
+ return overview(process.cwd())
55
+ })
56
+
57
+ program.hook('preAction', () => {
58
+ useFolderOrganization(process.cwd())
59
+ })
60
+
61
+ require('./commands/setup.command').register(program)
62
+ require('./commands/init.command').register(program)
63
+ require('./commands/auth.command').register(program)
64
+ require('./commands/project.command').register(program)
65
+ require('./commands/member.command').register(program)
66
+ require('./commands/link.command').register(program)
67
+ require('./commands/analyze.command').register(program)
68
+ require('./commands/find.command').register(program)
69
+ require('./commands/task.command').register(program)
70
+ require('./commands/plan.command').register(program)
71
+ require('./commands/build.command').register(program)
72
+ require('./commands/connect.command').register(program)
73
+ require('./commands/mcp.command').register(program)
74
+ require('./commands/sync.command').register(program)
75
+ require('./commands/engines.command').register(program)
76
+ require('./commands/usage.command').register(program)
77
+
78
+ try {
79
+ await program.parseAsync(argv)
80
+ } catch (err) {
81
+ if (err.name === 'ExitPromptError') {
82
+ process.exit(130)
83
+ }
84
+ console.error(process.env.TSPL_DEBUG ? err : err.message || err)
85
+ process.exit(1)
86
+ }
87
+ }
88
+
89
+ module.exports = {
90
+ run,
91
+ }